MyBB Community Forums

Full Version: Why does everyone hate inline styling so much?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
(2013-01-14, 03:12 AM)Nathan Malcolm Wrote: [ -> ]
(2013-01-14, 01:13 AM)CAwesome Wrote: [ -> ]
(2013-01-14, 12:37 AM)Nathan Malcolm Wrote: [ -> ]You can't scale it efficiently. Eventually your code becomes unmaintainable.

Your color-green idea is still flawed. If you do a total makeover and change the colour, your classes will quickly become confusing. You should just wrap your blog posts in a "post" div or something and go from there. e.g.: .post p { color: #333; }

My example was simply to provide an overview of reusable CSS which can easily be maintained. I'm not sure what you mean by "your classes will quickly become confusing"; green is green. You can change it to any shade you like and it will take affect across the site. Take the mobile Facebook site for example.

I think what brad means if you wanted to change from green things could get annoying quickly. At least, thats what it seems.
I don't really think it should be a question of what's the problem with it, as much as what's the benefit of it? The only one I can really think of is the benefit of being lazy. If things are coded right, 9 times out of 10 you won't have a single block that needs one line of code to fix it.

Working with MyBB is a whole different monster though, the way it's coded you almost have to use inline style just because of the massive amount of one line fixes already used, and needed (Falling into the badly coded category IMO).
(2013-01-14, 03:15 AM)Jason L. Wrote: [ -> ]I think what brad means if you wanted to change from green things could get annoying quickly. At least, thats what it seems.
Changing the colour scheme would likely involve more than just 5 element changes then - you're probably going to need to change font/heading colours too which means a separate CSS file would be easiest.

Inline is a good way to quickly hack things together (if you're lazy) but I still prefer a standalone CSS file. Each to their own I suppose?

Edit: Used the word 'class' instead of 'element'.
(2013-01-14, 04:12 AM)Ryan Loos Wrote: [ -> ]
(2013-01-14, 03:15 AM)Jason L. Wrote: [ -> ]I think what brad means if you wanted to change from green things could get annoying quickly. At least, thats what it seems.
Changing the colour scheme would likely involve more than just 5 class changes then - you're probably going to need to change font/heading colours too which means a separate CSS file would be easiest.

You could always just use classes like this:

.main-text-color { color: #; }
.main-bg-color { background-color: #; }

And add them to anything that you might want to change. Another benefit of classes.
(2013-01-14, 03:11 AM)CAwesome Wrote: [ -> ]
(2013-01-14, 01:30 AM)brad-t Wrote: [ -> ]That's not even close to what I'm talking about, Nathan.

For example, to make some elements line up, I had to give a span a relative position of -9px. Should I create a class just for this style that will be used only once? And create dozens of classes for one-time, barely styled elements, and end up with a huge global.css?

(I'm not trying to argue, it's just that "semantics!!" is not a compelling argument for me.)

Assuming it's some sort of sidebar block, you'd call the class sidebar-block and put the 9px in there. That way, you can use it on other sidebar'd pages.

That's a pretty big assumption to make. When I do stuff like this it's more like a single div that needs to be nudged a few pixels that only occurs on one page, like the forumdisplay of a specific forum (thanks, xThreads!). It seems weird to make a class for something that only happens once and doesn't repeat across pages (like, say, a menu).

Obviously I'm not using this for things like link colors or whatever ...

I just wonder if it's worth adding more and more and more stuff to my global.css for such small things.
For something like that not really.
Also external CSS files can be cached, inline style can't, so you're saving bandwidth (After the initial page load).
I must be the only one who uses semantic tags when I'm lazy.
(2013-01-14, 05:12 AM)Eric J. Wrote: [ -> ]Also external CSS files can be cached, inline style can't, so you're saving bandwidth (After the initial page load).

Yeah, this is the only compelling argument I've found, but I can't imagine less than 100 characters of styling adds up to much.
(2013-01-14, 02:15 PM)brad-t Wrote: [ -> ]
(2013-01-14, 05:12 AM)Eric J. Wrote: [ -> ]Also external CSS files can be cached, inline style can't, so you're saving bandwidth (After the initial page load).

Yeah, this is the only compelling argument I've found, but I can't imagine less than 100 characters of styling adds up to much.

Unless you're vBulletin and you store all CSS in a template for some stupid reason.
Pages: 1 2 3 4 5