473,467 Members | 1,986 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Headers (H1,H2,H3 etc) without a trailing blank line ?

Is it possible to use headers (H1, H2, H3 etc) but without a blank line
being inserted after them ? For example, at the moment the html I have
written gives me....
THIS IS THE HEADER

This is the paragraph of text

What I actually want to see is.....
THIS IS THE HEADER
This is the paragraph of text

Jul 20 '05 #1
5 2785

"George B" <gb******@hotmail.com> wrote in message
news:c0*********@news5.svr.pol.co.uk...
Is it possible to use headers (H1, H2, H3 etc) but without a blank line
being inserted after them ?
I believe, that margin-bottom: 0px, is all you need.

Jeff

For example, at the moment the html I have
written gives me....
THIS IS THE HEADER

This is the paragraph of text

What I actually want to see is.....
THIS IS THE HEADER
This is the paragraph of text

Jul 20 '05 #2
On Mon, 09 Feb 2004 03:20:12 GMT, Jeff Thies <no****@nospam.net> wrote:

"George B" <gb******@hotmail.com> wrote in message
news:c0*********@news5.svr.pol.co.uk...
Is it possible to use headers (H1, H2, H3 etc) but without a blank line
being inserted after them ?


I believe, that margin-bottom: 0px, is all you need.

Jeff


Actually, since p has a top margin, that won't be enough. This should work
in all visual-display CSS browsers, but is cumbersome.

<h2>Heading</h2>
<p class="afterh">Text</p>
<p>More text</p>

h2 {
margin-bottom: 0;
}

p.afterh {
margin-top: 0;
}
Jul 20 '05 #3
Neal wrote:
p.afterh {
margin-top: 0;
}


One could avoid having to create a specific class for this purpose by
using an adjacent selector:

h2 + p
{
margin-top: 0;
}

That way, the document needs not be changed and maintenance is
facilitated. The only problem left is, guess it, browser support. But I
would not care about it in this particular case.

Anyway, to the OP, next time please post messages of this kind to a more
appropriate newsgroup like c.i.w.a.stylesheets.

Regards,

--
Ney André de Mello Zunino
Jul 20 '05 #4
Tim
On Mon, 9 Feb 2004 02:49:09 -0000,
"George B" <gb******@hotmail.com> wrote:
Is it possible to use headers (H1, H2, H3 etc) but without a blank line
being inserted after them?
Actually, there isn't a blank line between them (just try putting the
cursor between them, and you'll discover there's nowhere for it to go),
just extra spacing between/around them.
What I actually want to see is.....

THIS IS THE HEADER
This is the paragraph of text


You'll want to play with the margins and padding for the h elements
(I'll suggest both, because you don't know what the defaults are for all
browsers).

e.g.

h1, h2, h3 {
margin-bottom: 0em;
padding-bottom: 0em;
}

Adjust the em value to suit, you may want a small but non-zero value.

Then you'd want to do something similar for p elements *following* h
elements.

e.g.

h1+p, h2+p, h3+p {
margin-top: 0em;
padding-top: 0em;
}

Something similar to that ought to get you started. But this is a
styling than HTML issue, and you might want to try a different news
group for more help: comp.infosystems.www.authoring.stylesheets

--
My "from" address is totally fake. The reply-to address is real, but
may be only temporary. Reply to usenet postings in the same place as
you read the message you're replying to.

This message was sent without a virus, please delete some files yourself.
Jul 20 '05 #5
It seems "Ney André de Mello Zunino" wrote in
comp.infosystems.www.authoring.html:
One could avoid having to create a specific class for this purpose by
using an adjacent selector:

h2 + p
{
margin-top: 0;
}


Your solution is correct according to the spec, so I'm sure it won't
surprise you that MSIE gets it wrong. MSIE doesn't handle adjacent
selectors correctly; from the above all p's (or maybe all h2's,
can't remember off hand) will have zero top margin.

Followups to comp.infosystems.www.authoring.stylesheets

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: dan glenn | last post by:
Hi. I'm finding that if I have text entered into a <textarea ...> </textarea> in a form, and that text has leading blank lines (with no spaces or anything else), that when I retrieve the entered...
3
by: Dave Sisk | last post by:
Hi Folks: I need the right regex to match either a comment line (--) or a blank line. What I've got below doesn't seem to be working like I'd expect. I've posted a snippet of what I have...
2
by: Danny | last post by:
Is there a way I can get rid of a blank like under an <h3></h3> tag? without using css Thanks in advance
2
by: Andy Fish | last post by:
Hi, This has nothing to do with the common "blank line after a form" problem. I have a form with a table with some radio buttons inside it, and I couldn't figure out why it was rendering an...
5
by: ChadDiesel | last post by:
My basic question is why does my print report button on my subform print a blank report when my cursor is on a blank entry line? Here is a more detailed explanation of my problem. I have a...
0
by: erucevice | last post by:
I am trying to bcp a text file that is written out of a Java application. The text file has important order information that I need to bcp into a SQL Server 2000 database. The problem is that when...
6
by: Timur Tabi | last post by:
Is there a way I can have the browser automatically insert a blank line after each definition in a definition list? Right now I have this: term-1 definition text .... term -2 definition text...
4
by: djaekimaar | last post by:
Hi. First I apologise if there is a better place to post this. Please let me know. I also apologise in advance if this is a really stupid mistake, but now seem to be bashing head against wall. I...
3
by: BarbQb | last post by:
Hi All, I currently have a form with a multiselect list box that shows Vehicle IDs (Column 0) and Vehicle Statuses (Column 1) by customer. The VehicleID column is the bound column. Occasionally...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.