|
|||||||
| CSS Discussion and technical support relating to Cascading Style Sheets. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
custom selectors ?
Hi, sorry for the newbie question, I'm new to all this but having a go.
What I'm trying to achieve is extremely simple, essentially I just want a part of some text in the footer a certain colour. I thought acc, for accent might be a reasonable name for it. I tried this: Code:
acc{color: #6600FF; clear:both;}
Code:
A <acc>quick</acc> brown fox jumps over the lazy dog. So I changed it to a class so: Code:
.acc{color: #6600FF; clear:both;}
Code:
A <span class="acc">quick</span> brown fox jumps over the lazy dog. However it got me wondering, can you not have 'custom' selectors similar to say p or h1 etc. and I have to make it a class and use the span tags every time ? |
|
#2
|
|||
|
|||
|
Yes you can. Create a custom DTD and use it as your doctype. However, this SHOULDN'T be done. If you've been in the industry long enough you'll recall that the one of the objectives why the W3C was formed was to avoid just anyone creating their own elements (standardization). Your the only one that knows the meaning of your element.
|
|
#3
|
|||
|
|||
|
Quote:
|
|
#4
|
|||
|
|||
|
#5
|
|||
|
|||
|
Thanks for your help. Haven't exactly been in the industry... my qualifications are in comms cabling.
|
|
#6
|
||||
|
||||
|
But before you use the SPAN tag, ask your self "What am I trying to say?" Chances are that if you are trying to make some text stand out then you are trying to emphasize that text then you should use EM of STRONG. Only use SPAN as a last resort and then give it a class with a name that describes why you are setting that text apart.
http://www.w3.org/TR/html4/struct/text.html#h-9.2.1
__________________
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.” —Tim Berners-Lee, W3C Director and inventor of the World Wide Web |
|
#7
|
|||
|
|||
|
It's to apply a certain colour to words, in line with one of the main colours used on the site to make them stand out. So I would like any changes to that colour reflected across the site, if the colour scheme is changed or altered slightly.
Isn't strong more akin to bold ? |
|
#8
|
||||
|
||||
|
It's a question of how much emphasis is required.
__________________
At least 98% of internet users' DNA is identical to that of chimpanzees |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|