You are here: Re: css and <ul> inside a <p> paragraph « HTML « IT news, forums, messages
Re: css and <ul> inside a <p> paragraph

Posted by Beauregard T. Shagnasty on 09/23/07 15:55

Joe Butler wrote:

> I have a basic, Title, series of paragraphs, Title, Series of
> paragraphs, etc. etc. structure to a page.
<snip>
> If the paragraphs belonging to a particular title are simply text,
> then I can break up the paragraphs with <br><br> to give me a blank
> line between the paragraphs.

If you want a bottom margin after a paragraph, use CSS:
p { margin-bottom: 2em; }
instead of <br>'s, which *might* be used within a paragraph (rarely),
but most commonly within a postal address block, for example.

> Now, if I need to put a list between two of the paragrapsh, the list
> is not 'inside' the paragraph - I guess you could say it does not
> inherit the sytle of the paragraph that it is being displayed in.

Paragraphs ( <p> ) cannot contain other block-level elements, such as
the <ul> you mention. Starting a <ul> closes the <p>.

> Then, when the list ends, I have to re-state that we are using the
> paragraph style, otherwise the following paragraphs don't have the
> correct style (mainly the margin indent).

An URL to your page would help.

> So, the question is, what is the correct way to deal with this so that I can
> say, here are a set of things that are all inside this paragraph style, and
> things like lists will add their own defined left margins to whatever the
> containing paragraph style is?
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">

New documents should be Strict, not Transitional.

> <p class="article-title">This is the title</p>
This should probably be an <h1> or maybe an <h2>, if you already have an
<h1> on the page.

> <p class="article">
> this is the article text.

You forgot the closing </p>. However, most browsers will implicitly
close it for you.

> <ul> <-- this is not within the above <p>
> <li>list item 1.</li>
> <li>list item 2.</li>
> <li>etc.</li>
> </ul>
>
> <p class="article">
> another paragraph.

Let's see the URL to a test case, instead of partial code fragments.

--
-bts
-Motorcycles defy gravity; cars just suck

 

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

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