CSS vs. HTML (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


BeTheBall -> CSS vs. HTML (6/22/2006 11:21:58)

Should one use CSS for all formating? For example, if I have one word in a sentence that I want to be bold, should I put it in <span> with a class or is it still acceptable to use <strong> tags? Or centering a paragraph, should I use a class or is the align attribute acceptable?




markhawker -> RE: CSS vs. HTML (6/22/2006 11:26:05)

I think it depends on the coder, personally I'd put it in a CSS. What if instead of having a highlighted item bold I also wanted it to be red? You'd have to add and update each element seperately. If you didn't actually want your text to be centred you'd have to modify this in the code of each page rather than in one CSS. Unless it's damned cellspacing in IE!!!




Tailslide -> RE: CSS vs. HTML (6/22/2006 11:35:16)

I use strong tags - they have a semantic meaning which goes beyond styling and which you'd want a screen reader to pick up on whereas just styling a span to be bold would be lost on it - so definitely go for using the strong tag. Think of it as a sort of sub heading rather than just as styling.

You can style the strong tag however you want via the CSS but the meaning (i.e. that whatever's within them is important) needs to be emphasised properly with the correct tag - i.e. the strong tag.




jaybee -> RE: CSS vs. HTML (6/22/2006 12:23:08)

Shouldn't one be using the emphasis tag for that sort of thing?




Tailslide -> RE: CSS vs. HTML (6/22/2006 12:32:04)

No emphasis is a different thing (strangely!). Without extra CSS styling Strong would be bold to look at and give a semantic meaning of importance compared to surrounding text (I think it's spoken more loudly by screenreaders not sure though) whereas em would be itallic and give a meaning of change of emphasis from the surrounding text not necessarily more important.

Splitting hairs but there is a difference.

BTW they're not straight replacements for the "b" tag and the "i" tag - which are just styling info - they have meaning where the older tags don't

Edit: actually, on reflection I think em isn't just a change of emphasis - it is an increase in importance too (you couldn't really have a change of emphasis downwards I suppose) - just not as much as strong.




jaybee -> RE: CSS vs. HTML (6/22/2006 12:53:01)

Why do I see another mess along the lines of abbr and acronym looming? [;)]




Tailslide -> RE: CSS vs. HTML (6/22/2006 12:53:49)

They're different too although I get into fights about their proper definitions




jaybee -> RE: CSS vs. HTML (6/22/2006 12:56:59)

Exactly, they're different but not for long. [&o]




Tailslide -> RE: CSS vs. HTML (6/22/2006 13:06:16)

They should be different - they have different meanings. I'm not well pleased about the changes. Doesn't suit my pedantic nature!




yb2 -> RE: CSS vs. HTML (6/23/2006 14:30:36)

quote:

Should one use CSS for all formating?


Nah, that's taking a useful tool and using it for the sake of it.

quote:

For example, if I have one word in a sentence that I want to be bold, should I put it in <span> with a class or is it still acceptable to use <strong> tags?


I find it acceptable. But then I find farting and burping acceptable.[:'(][:o][:)]

quote:

Or centering a paragraph, should I use a class or is the align attribute acceptable?


Most likely CSS is best for positioning as it's likely to be repeated on other pages.




jaybee -> RE: CSS vs. HTML (6/23/2006 14:37:51)

quote:

Nah, that's taking a useful tool and using it for the sake of it.


Ummmm that's the whole point. You use CSS to take all the formatting out of the page so that all that's left is the content.




yb2 -> RE: CSS vs. HTML (6/23/2006 15:15:55)

HTML is formatting and is part of the presentation layer, while CSS is only an extension of HTML, and thus does not seperate presentation from content. CSS is useful for making changes to several tags at once, for example site wide formatting, but it's not any more useful than bog standard tags for single-instance formatting and holds no technical advantage in a single instance context.




Tailslide -> RE: CSS vs. HTML (6/23/2006 15:28:30)

For single instances it doesn't have an advantage except that it's usually still less markup on the HTML page itself - plus it's just nicer to have it all in one place - not in the markup. Maybe that's just me though - I like things neat!

Edit: oh and obviously there are formatting tags that are deprecated in XHTML strict so you've got no choice but to put it in the CSS - or be invalid (imagine!).




rdouglass -> RE: CSS vs. HTML (6/23/2006 16:34:28)

I personally almost always now use CSS "font-weight" and use a class, id, or inline style. So bolding generally involves a <span> tag for me but not always. An addition to this is if I want to change the item dynamically at the client. Then I *always* use a <span> tag.

I know it is more markup but it's easier for me to see these items in code views that way and I always get the expected results when it comes to font stuff. Why fix what ain't broke?




yb2 -> RE: CSS vs. HTML (6/23/2006 16:39:20)

quote:

Maybe that's just me though - I like things neat!


Fair enough if that's your preference, but I think the tidyness argument is a little bit dodgy as you'll end up with as many little bits floating about in your css as anywhere else! :)

quote:

You use CSS to take all the formatting out of the page so that all that's left is the content.

quote:

HTML is formatting and is part of the presentation layer, while CSS is only an extension of HTML, and thus does not seperate presentation from content.


To be fair, I had further look around L'Internet, and a lot of web designers regard xhtml as part of the data layer. Personally, I think that's incorrect, I would consider xml as part of the data layer and xhtml as presentation (transforming xml into xhtml if it was to be viewed in a browser). But since a lot of people won't be using databases and/or xml to store their data, then I can see why it might be viewed in such a way. Perspective is influenced by the technology.

I still wouldn't stick a one-off in .css though, but that's a preference too.









Tailslide -> RE: CSS vs. HTML (6/24/2006 3:01:28)

quote:

ORIGINAL: yb2 I think the tidyness argument is a little bit dodgy as you'll end up with as many little bits floating about in your css as anywhere else! :)


I don't just have CSS rules scattered around my stylesheets willy-nilly you know! Oh no! I organise them neatly into sections so I know what's where. (me? Obsessive? Naaaaah)




yb2 -> RE: CSS vs. HTML (6/25/2006 10:53:36)

Nobody round here thinks you're mental in any way...[8|]




Tailslide -> RE: CSS vs. HTML (6/25/2006 11:19:43)

[:D] Yeah well for most of the people round here it'd be a case of "Hello Pot, my name's Kettle"




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625