• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Including CSS

Chroder

New Member
I want some text to be a certain style which I defined in my CSS sheet. I was just wondering if there's way to make text be the style without using "class="mystyle" in a HTML tag.

For example, I know I can go
Code:
<b class="mystyle">Styled</b>

But is there some kind of "special" tag that doesn't alter the text in any other way except the defined style? Like
Code:
<class="mystyle">Styled</class>

Obviously that tag doesn't exist, just wondering if something similar does exist.

Tell me if I make no sense ;)

Thanks
 
I'm not sure I completely understand what you're asking, but why don't you just use <div>?
 
Yup, I was thinking of that, just wondering if there's some "special" tag just for that, guess not ;)
 
<b class="mystyle">Styled</b>

oh:confused:

I never knew that there is a tag like that.

What's it for?

Anyway, <div> is simple and good.
 
DIV is a block level element so it will cause a line break before and after. Its in-line equivalent is SPAN, probably what you are looking for. Neither DIV nor SPAN has any default styling in the browser or any meaning (besides that DIV formes a block).

It's better to use a meaningful HTML tag though and change how it looks with CSS. It's possible to build a page of nothing else than styled DIVs and SPANs but it will collapse to a porridge of letters with CSS off.
 
i believe in that people who have browsers that don't support CSS or turn them off on purpose do not deserve to see "pretty" web pages, or have a computer bad enough that it's better off for them to see all text instead. so using span is fine.

but, for your information, if you really want to use other tags like a "b" tag in your example, you can always change the style of that class (so for this example, do font-weight: normal to get rid of the bold style for this class) anyway.
 
Do you think a text browser or a braille reader or why not Google bot are among those "bad browsers"? I wasn't referring to presentational HTML like B, but structural HTML like H1, P, UL and so on.

Besides, doesn't it become a a pain in the butt to build a site of all DIVs and SPANs and have to class every little bit because you can't use intelligent selectors without a good HTML structure? :D
 
Back
Top