Urban75 Home About Offline BrixtonBuzz Contact

css... how do I?

tendril said:
but this is what I have done with the class associated to my <font> tag. e.g. <font class="bold">Hello World"</font> is no different in my site than <span class="bold">Hello World"</span>

I had no idea that that worked. Looking it up, it appears to be valid HTML4, which surprises me a bit.

In that case it's just unconventional and reminds people of the usual, deprecated use of the FONT tag with literal sizes, colours and, er, fonts.

It does slightly break the distinction between SPANs as inline markup (of which <EM> is a special case) and DIVs as block structure (of which <H1> is a special case).

But I'm sure I have a SPAN with display:block somewhere, having failed to tidy up...


tendril said:
because I am changing the class, which may be assigned to any tag that will take it. i.e. if I want a whole paragraph of bold text, cannot I apply this to a <p>: <p class="bold"> where I have defined .bold in my css. If I want to change all the instances of bold text throughout I just change the .bold in the css. So why is <font> worse than <span> if used in theis way? I am only appling the class to a tag. It's just that the tag is<font> not <span>.

See above... yes, you can apply it to <P< and all (unless you restrict it in the CSS with span.bold {stuff}

But class="bold" isn't an ideal construct - what happens when you don't want it bold any more, but rather red?

class="sarcasm" is a better construct for picky people, so long as that's what the span encloses.

class="loud" would be better for this site :)

Or you could just use <STRONG> (which has always been preferred to <B>) and redefine it in CSS.
 
laptop said:
And images that are purely decorative should have

Code:
ALT=""
Um, no - images that are purely decorative should not be in the HTML at all, they should be in the CSS.
laptop said:
You can use span to make your own equivalents of STRONG, CITE, etc:
Why on earth would you want to do that?? If the text is to be emphasised, or is a citation, use the correct HTML element - don't try to recreate it using a semantically-neutral <span>. :rolleyes:
 
Buddy Bradley said:
Um, no - images that are purely decorative should not be in the HTML at all, they should be in the CSS.

You've found the limit of my purism :D I can see that getting messy... what with incompatible browsers and all...

Buddy Bradley said:
Why on earth would you want to do that?? If the text is to be emphasised, or is a citation, use the correct HTML element - don't try to recreate it using a semantically-neutral <span>. :rolleyes:

It was meant to be an illustration of what SPAN can be used for. As with the class-"sarcasm" example.
 
laptop said:
You've found the limit of my purism :D I can see that getting messy... what with incompatible browsers and all...
:confused: I've not come across any modern browsers that cause any problems at all with using CSS background images. If you still have to cope with version 4 browsers then fair enough, but in that case you wouldn't be using much CSS anyway...
 
Buddy Bradley said:
:confused: I've not come across any modern browsers that cause any problems at all with using CSS background images. If you still have to cope with version 4 browsers then fair enough, but in that case you wouldn't be using much CSS anyway...

Ah, I wasn't thinking of background images. (Though there are/have been inconsistencies in what directory browsers expect to find them in, if the .CSS isn't in the same directory as the .html)

I was thinking, for example, of a site I maintain that has little arrows on major links (it has a lot of hard-of-thinking users, particularly among the "client" group). I tried the :before directive/thingy... and gave up in despair pretty soon. They all have ALT="*".

I also use invisible images with ALT="&pilcrow;" to punctuate search engine results :)
 
There's no confusion where images are found if you write your URLs properly. ;) Putting images inline is a massive code bloat when you could just specify it once in your CSS.

Search engine results are a list, btw. :)
 
Buddy Bradley said:
There's no confusion where images are found if you write your URLs properly. ;)

Er, it'd work if you used absolute URLs. But there are major maintenance advangages to relative URLs. I no longer rememer how old are the browsers that get them wrong...

Search engine results are a list, btw.

I meant to say, to punctuate the extracts, where the contents of the extract are a de-listed list.
 
Have you tested using alt="&pilcrow;" in screenreader software? Be interesting to know if it pronounces it correctly or just reads out the literal text.
 
bouncer_the_dog said:
I find I use #customdiv { } all the time; appearing in html with <div id="customdiv"></div>

I rarely use .somthing { } with <div class="somthing"></div>

is that OK?
That's usually how I work too. A DIV is a page division, so nine times out of ten you're only going to have one of them on a page, in which case using an id (#mydiv) is the right choice.

You only really need to use a class (.myclass) if there are going to be more than one of that type of styled element.
 
Back
Top Bottom