Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Define <p> inside article  (Read 2568 times)

Olle Axelsson

  • Jr. Member
  • **
  • Karma: 3
  • Posts: 71
    • Eatlon.com
Define <p> inside article
« on: July 10, 2007, 11:34:58 am »

I have implemented in the snews.php a div class-tag around the article text. If I use div id the site doesn't validate (since there's an id for every single article), so I must use class. My problem is that I can't define the p-tag inside a class, only an id.

Validation error:
#article_text { }
#article_text p { }

Doesn't work:
.article_text { }
.article_text p { }

Any suggestions of a way through the dark tunnel?
« Last Edit: August 22, 2007, 01:35:56 am by Phil Martin »
Logged
Eatlon.com
Free XHTML/CSS templates and a bucket of webdesign resources

Joost

  • Guest
Define <p> inside article
« Reply #1 on: July 10, 2007, 12:56:54 pm »

Long time ago since I have validated css. If my memory isn't failing, w3c wants the element defined like this:

div#article_text { }
div#article_text p { }
Of course there can be only one.

or

div.article_text { }
div.article_text p { }

If this is not workin', most likely there are values set for element 'div' or 'p' further down the stylesheet.
« Last Edit: August 22, 2007, 01:36:13 am by Phil Martin »
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Define <p> inside article
« Reply #2 on: July 10, 2007, 01:05:45 pm »

Nope, you don't need to set div# or div. it's sufficient with either # or the dot .
« Last Edit: August 22, 2007, 01:36:31 am by Phil Martin »
Logged
"It's only dead fish that goes with the flow... "
Updated

Olle Axelsson

  • Jr. Member
  • **
  • Karma: 3
  • Posts: 71
    • Eatlon.com
Define <p> inside article
« Reply #3 on: July 10, 2007, 01:21:04 pm »

It's not the CSS but the XHTML who fails validation.

But it's okay. Patric and I have almost solved it. We have a couple of solutions. :)
« Last Edit: August 22, 2007, 01:36:45 am by Phil Martin »
Logged
Eatlon.com
Free XHTML/CSS templates and a bucket of webdesign resources