Old 14-04-2008, 22:51   #1 (permalink)
campbell
Web Hoster
 
campbell's Avatar
 
Join Date: Jan 2008
Location: Canada
Posts: 140
Specificy

On a website I am making, if i have two divs, one called "right" and the other "left" and I want the <strong> text to appear different in both, would I do something like this in the css file.

. right strong{
color: 123456;

}

. left strong{
color: 654321;

}
  Reply With Quote
Old 14-04-2008, 22:55   #2 (permalink)
haku
shiro
 
haku's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,084
Yes, assuming that left and right are classnames and not ids.

Also you need a # before the color ids.
  Reply With Quote
Old 14-04-2008, 23:35   #3 (permalink)
campbell
Web Hoster
 
campbell's Avatar
 
Join Date: Jan 2008
Location: Canada
Posts: 140
ok, so there is no symbol like a period or underscore between "right" and "strong"?
  Reply With Quote
Old 15-04-2008, 00:12   #4 (permalink)
Heka1
Senior Member
 
Join Date: Jul 2007
Posts: 179
Nope, you have it right.
__________________
XHTML, CSS, PHP, Flash Web Designer
www.Heka1.com
www.DrunkMobile.com/m
  Reply With Quote
Old 15-04-2008, 01:42   #5 (permalink)
rustybones
buttock racer
 
rustybones's Avatar
 
Join Date: Oct 2007
Location: Sweden
Posts: 196
Maybe there shouldn't be a space between the full stop and the class name.

For example you have:

Code:
. left strong { color: 123456; }

it should be more like this:

Code:
.left strong { color: #123456; }

you should probably have the hash in front of your colour code too
  Reply With Quote
Old 15-04-2008, 02:23   #6 (permalink)
haku
shiro
 
haku's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,084
Good eye on the space - I didn't see that!
  Reply With Quote
Old 15-04-2008, 10:44   #7 (permalink)
wheedwacker
competitionmaster 2.0
 
wheedwacker's Avatar
 
Join Date: Oct 2006
Location: USA
Posts: 1,348
Quote:
Originally Posted by haku
Good eye on the space - I didn't see that!
neither did I.
__________________
  Reply With Quote
Old 15-04-2008, 16:46   #8 (permalink)
paulmsmith
Paul Michael Smith
 
paulmsmith's Avatar
 
Join Date: Apr 2008
Location: Manchester, UK
Posts: 6
There is a nice document explaining CSS Specificity here:
stuffandnonsense.co.uk/archives/css_specificity_wars.html.
  Reply With Quote
Old 15-04-2008, 16:51   #9 (permalink)
campbell
Web Hoster
 
campbell's Avatar
 
Join Date: Jan 2008
Location: Canada
Posts: 140
So, in this case, (shown below) I have a script for rounded corners. However, I can't find a way to make it be specifictly for the "right" or the "left"

CSS CODE

Quote:
div#right{ margin: 0 10%;background: #9BD1FA}

b.rtop, b.rbottom{display:block;background: #FFF}
b.rtop b, b.rbottom b{display:block;height: 1px;
overflow: hidden; background: #9BD1FA}
b.r1{margin: 0 5px}
b.r2{margin: 0 3px}
b.r3{margin: 0 2px}
b.rtop b.r4, b.rbottom b.r4{margin: 0 1px;height: 2px}


HTML

Quote:
<div id="right">

<b class="rtop"><b class="r1"></b><b class="r2"></b><b class="r3"></b><b class="r4"></b></b>

BLAH BLAH BLAH. Text goes here.

<b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1"></b></b>


</div>
  Reply With Quote
Old 15-04-2008, 17:37   #10 (permalink)
.sleep
Senior Member
 
.sleep's Avatar
 
Join Date: Mar 2007
Location: california
Posts: 262
Send a message via AIM to .sleep
Quote:
Originally Posted by campbell
Code:
b.rtop, b.rbottom{display:block;background: #FFF}

Code:
div#right b.rtop, div#right b.rbottom{display:block;background: #FFF}
repeat as necessary
  Reply With Quote
Old 15-04-2008, 18:46   #11 (permalink)
campbell
Web Hoster
 
campbell's Avatar
 
Join Date: Jan 2008
Location: Canada
Posts: 140
One question, what is the point of putting "div" infront of "#right"?
Just wondering, because some poeple do it with it and some people do it without.
  Reply With Quote
Old 15-04-2008, 21:33   #12 (permalink)
haku
shiro
 
haku's Avatar
 
Join Date: Aug 2007
Location: Yokohama, Japan
Posts: 2,084
Adds more specificity.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8