Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
'br' and 'a' on the end of classnames?
Old 05-14-2009, 08:58 PM 'br' and 'a' on the end of classnames?
Skilled Talker

Posts: 54
Name: Fred
Trades: 0
Fairly new to CSS, so please bare that in mind

I've noticed when messing around with my forum's CSS that on occassion the same classname is defined more than once. The difference being that these additional classnames have br and a on the end (see example)

Quote:
.classname { styling }
.classname br { styling }
.classname a { styling }
What do the 'br' and 'a' indicate?

Thanks in advance.
Billy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-14-2009, 10:06 PM Re: 'br' and 'a' on the end of classnames?
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I think this syntax is wrong.
You can specify different value for a given class, but differentiated by elements.

But the syntax would be
Code:
.class{...} /* apply to every elements with that class*/
br.class{...}  /*applies only to br*/
div.class{...}  /*applies only to div*/
But the selectors can be way more precise than this.
You can have :
Code:
h3 > div {} /*every div's that are into an h3 element*/
a[specialAttr] {} /*to every a elements who have an attribute named "specialAttr"*/
a[attr|="fir"] {} /* to every links where the attribute "attr" starts with "fir"*/
I have always found Dave Child's cheat sheet pretty clear and helpful:
http://www.addedbytes.com/cheat-sheets/css-cheat-sheet/
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 05-14-2009, 10:24 PM Re: 'br' and 'a' on the end of classnames?
Skilled Talker

Posts: 54
Name: Fred
Trades: 0
Thanks, tripy, but I don't understand a single word you just typed. I did warn you.

This is from my forum's CSS

Quote:
.ak_poll_table_header {
background-color: #ddcccc;
height : 22px;
padding : 0 25px 0 5px;
font-size : 12px; color: #000;
text-align: left;
text-transform: uppercase;
}
.ak_poll_table_header br {
display : none;
}
.ak_poll_table_header a {
padding-left : 11px;
}
What are .ak_poll_table_header br and .ak_poll_table_header a targeting, that .ak_poll_table_header on its own isn't?

Last edited by Billy; 05-14-2009 at 10:26 PM..
Billy is offline
Reply With Quote
View Public Profile
 
Old 05-15-2009, 04:20 AM Re: 'br' and 'a' on the end of classnames?
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I'0m in no mean a css expert, but I'd say that having it wrote
Code:
.ak_poll_table_header a
would means "every <a> elements and every elements with the class "ak_poll_table_header".

At contrario, if it would be wrote
Code:
a.ak_poll_table_header
it would mean that the specific code would only be applied to <a> elements with the class ak_poll_table_header
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 05-15-2009, 06:20 AM Re: 'br' and 'a' on the end of classnames?
Extreme Talker

Posts: 189
Trades: 0
Code:
.ak_poll_table_header a
I would say this meant any a tag in something which the class name of ak_poll_table_header
simster is offline
Reply With Quote
View Public Profile
 
Old 05-15-2009, 10:08 AM Re: 'br' and 'a' on the end of classnames?
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
This is a method to target areas of your document using less id's and classes overall.

This method will "aim" for items nested within a certain id or class. Here is an example, let's say you wanted to style an anchor, but ONLY an anchor within a div with a class of "info":

<div class="info">
<p>hello</p>
<ul>
<li><a href="#">item 1</a></li> <!-- you want to style this anchor -->
</ul>
</div>

In your css you could target this anchor by:
.info ul li a {
/* this is styling that applies to the anchor above */
}

Do you see how I didn't have to create a special class for that anchor? Plus, in my css I can clearly see what area of the document I am styling. Very helpful for css that runs into hundreds of lines of code.

This is called using the DOM(document object model) you can visit http://www.w3schools.com/js/js_obj_htmldom.asp

Last edited by racer x; 05-15-2009 at 03:03 PM.. Reason: I had id for info in css oops
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Old 05-15-2009, 12:31 PM Re: 'br' and 'a' on the end of classnames?
angele803's Avatar
Perfectly Imperfect

Posts: 1,774
Name: Stephanie
Location: Oklahoma
Trades: 2
.classname { styling } - any element with the class "classname"
.classname br { styling } - any "br" tag inside an element with the class "classname"
.classname a { styling } - any "a" tag inside an element with the class "classname"
__________________

Please login or register to view this content. Registration is FREE
angele803 is offline
Reply With Quote
View Public Profile
 
Old 05-15-2009, 01:56 PM Re: 'br' and 'a' on the end of classnames?
Skilled Talker

Posts: 54
Name: Fred
Trades: 0
Thanks very much to you all. Those explanations have made it far clearer now
Billy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to 'br' and 'a' on the end of classnames?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 2.00175 seconds with 12 queries