Users can enter descriptions which may include paragraphs or lists. Or they may just enter text without any enclosing <p>
or <ul>
elements. What I need to do is remove most of the padding and margin above the first element and below the last element so that the user entered content has a nice tight border around it. So I could do one of the following:
- Use a css rule I was unaware of to target only the first and last elements
- Use css3 or html5 (I assume there's something within these to easily do what I want) and hope everyone upgrades their browsers asap while the older browsers just get a slightly uglier version of the page
- Find the first and last elements with Javascript and modify accordingly
- Modify the html to add a class like
<p class="first">
Ideally the 1st solution exists, does it? I'm ok with the 2nd solution though if not, does it exist? The last 2 I don't care for...
UPDATE: don't care about IE6. But I do need to deal with the situation that if there's just text to begin with, without any <p>
or <ul>
or other elements, then actually nothing special needs to be done for the top margin/padding.