You are here: Re: CSS nesting... « HTML « IT news, forums, messages
Re: CSS nesting...

Posted by Barbara de Zoete on 08/10/05 14:35

On Wed, 10 Aug 2005 11:20:25 GMT, Noozer <dont.spam@me.here> wrote:

> I have the following CSS classes defined... "result", "row" and "title"
>
> How do I declare each of these in my CSS page so that row and title will
> only be applied when within elements with the "result" class?
>
> For example...
>
> <div class="result">
> <span class="title">My Example</span>
> <span class="row">This is the first row.</span>
> <span class="row">
> <span class="title">My Subtitle</span>
> <p>This text is part of the second row. It should have a title above
> it</p>
> </span>
> </span>
> </span>
> </div>
>

This is a very strange use of span. Besides that: you cannot nest a paragraph
inside a span. A span is an inline element. A paragraph is a block level
element. Can't have block level elements inside inline elements.

Why do you not just use headers and paragraphs? What is the effect you're after?

<div class="result">
<h1>My Example</h1>
<p class="first-row">This is the first row</p> <!-- what's with that 'row'
stuff? -->
<h2>My Subtitle</h2>
<p>This text is part of the second row. It should have a title above it</p>
</div>

Then you can use the following selectors in your stylesheet:

..result
..result h1
p.first-row
..result h2
..result p

I bet all styles you could want/need fit with these five selectors.

--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация