You are here: Re: What's wrong with this HTML (fails validation) ? « HTML « IT news, forums, messages
Re: What's wrong with this HTML (fails validation) ?

Posted by Jonathan N. Little on 02/14/07 18:32

robert maas, see http://tinyurl.com/uh3t wrote:
>> From: "Chris F.A. Johnson" <cfajohn...@gmail.com>
>> Or use a new <p> with padding-top and margin-top set to 0.
>
> Let me see if I can find the documentation for that ...
> <http://www.w3.org/TR/CSS21/box.html>
> shows only how to do it in CSS, not directly in the element, so
> that's useless for me because not all browsers support CSS, in
> particular the only browser available to me for testing over VT100

Anything in recent history, Yeah 10-year old browser will have trouble
but who is using one? I should you how to get what you wish, if the code
is a one-liner then semantically you should use the CODE element. To
style the inline CODE element on its own line then:
<!-- CSS -->
<style type="text/css">
P CODE { display: block; }
....

<!-- HTML -->
<p>
Paragraph text above code...
<code>Your code snipped </code>
continuation paragraph text below ...
</p>

Now if you have multi-line code you could use the PRE element and you
can give it the class "code". Now unfortunately IE does not support
"sibling selectors" so for IE you will need classes for the P above and
below the code snippets to remove the margins

<!-- CSS -->
<style type="text/css">
/* remove spacing on code PRE blocks */
PRE.code { margin: 0; padding: 0; }

/* for para before */
P.beforeCode { margin-bottom: 0; color: blue; }

/* for para after */
P.afterCode { margin-top: 0; color: red; }
...

<!-- HTML -->

<p class="beforeCode">
The para before your code block ...
</p>
<pre class="code">
Your code sample ...
</pre>

<p class="afterCode">
The para after your code block ...
</p>


<snip>

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

 

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

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