Please help with a simple xhtml css question noob here (9)

1 Name: #!/usr/bin/anonymous : 2008-05-09 00:33 ID:6XsshTmJ

Okay, the html document has these elements:

<p> This is a paragraph </p>
<p id="dinosaur">This is a paragraph with a dinosaur.</p>

And the css file contains these properties:

p {border-style:dotted;}
p#dinosaur {border-style:solid; border-color:green}

Why does the second paragraph have a dotted border but is green?

2 Name: #!/usr/bin/anonymous : 2008-05-09 05:33 ID:1CF98FWO

Answer: The C in CSS stands for Cascading.

3 Name: OP : 2008-05-09 11:17 ID:Heaven

nevermind. it works the way it is.

4 Name: #!/usr/bin/anonymous : 2008-05-09 13:17 ID:Heaven

[HELP] Single questions & Help Thread [n00b]
http://4-ch.net/code/kareha.pl/1209513777/l50

5 Name: #!/usr/bin/anonymous : 2008-05-15 06:13 ID:lqFgPywq

btw, no need to ever put anything in front of a #thing because there can be only one #thing.

6 Name: #!/usr/bin/anonymous : 2008-05-15 12:58 ID:Heaven

>>5

I thought that restriction was that HTML documents could not contain repeated IDs--does it apply to CSS as well? Not that I would ever do so, but I could have p#thing and ul#thing in the same style sheet, linked to multiple HTML documents, only using one rule or the other in each.

7 Name: #!/usr/bin/anonymous : 2008-05-17 15:34 ID:lqFgPywq

that's a possibility i hadn't thought about. i think your scenario would be fine. that's probably why it's allowed in the grammar. i stand corrected. thanks.

8 Name: sage : 2008-08-10 21:39 ID:DEk1BggU

>>6

It is restricted on only HTML. in CSS #thing can appear no matter how many times you want it to.

9 Name: #!/usr/bin/anonymous : 2008-08-10 23:48 ID:Heaven

>>6

You can't have a p#thing and a ul#thing but for a different reason- you can't change the tag of an element after it's created so one of them simply doesn't make sense. Some people take advantage of this when sharing a css file across multiple pages with different physical layouts on different pages.

This thread has been closed. You cannot post in this thread any longer.