473,465 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

empty line with H tag, how to get rid of it with CSS

The empty line that is inserted by most browsers between H1/H2/H3
heading tags and a following P block is very annoying and I would
really like to get rid of it (without having to give up on using the
H1/H2/H3 tags).

I put
H3{
margin : 0px;
}

It eliminates only the empty line on top of H3, not th eline below of
it. How can I pix it?

I am using IE.

Thanks,

Jul 21 '05 #1
2 3274
au******@yahoo.com wrote:
The empty line that is inserted by most browsers between H1/H2/H3
heading tags and a following P block is very annoying and I would
really like to get rid of it (without having to give up on using the
H1/H2/H3 tags).

I put
H3{
margin : 0px;
}

It eliminates only the empty line on top of H3, not th eline below of
it.
You need to remove the margin above the paragraph as well as the one
below the heading. In CSS adjacent vertical margins combine to the
height of the tallest.
How can I pix it?
h3 {margin-bottom: 0;}
p {margin-top: 0;}

Of course, in theory you would use
h3 + p {margin-top: 0;}
to only remove the top margin from those paragraphs that follow the
heading. But as IE doesn't support the sibling selector + we need to
use the more general rule.
I am using IE.


So what? Are you building this web site just for yourself or for
visitors as well?

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 21 '05 #2
au******@yahoo.com wrote:
The empty line that is inserted by most browsers between H1/H2/H3
heading tags and a following P block is very annoying and I would
really like to get rid of it (without having to give up on using the
H1/H2/H3 tags).

I put
H3{
margin : 0px;
}

It eliminates only the empty line on top of H3, not th eline below of
it.


There is no empty line. It eliminates the margin, which can probably be
inferred from the fact that the CSS for this is

margin: 0;

and not

empty-line: none;

In any event, CSS uses that logic that the vertical separation between
adjacent blocks is the *larger* of the bottom margin of the upper block
and the top margin of the lower block. In other words, each block is at
*least* as far away from its vertical neighbors as it wants to be, and
as far away as *they* want to be if that's larger. This is instead of
adding the margins together, as is done for horizontal placement, which
usually results in separations much larger than desired.
Jul 21 '05 #3

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

Similar topics

3
by: tornado | last post by:
Hi all, I am pretty new to PHP. I was reading PHP manual and trying out the example from 2nd chapter (A simple Tutorial). When i try to print the variable as given in the example it returns...
7
by: Dan | last post by:
I was trying to troubleshoot a login page that doesn't work - it keeps saying the login/password is missing - when my tracing discovered this peculiar behavior. register_globals is off, so at...
9
by: ted | last post by:
I'm having trouble using the re module to remove empty lines in a file. Here's what I thought would work, but it doesn't: import re f = open("old_site/index.html") for line in f: line =...
17
by: AMC | last post by:
Hi, I'm using an include file to store the connection string to a database. Whenever I try to reference that string to open a connection in the page that includes the file I get the error 'empy...
6
by: mary | last post by:
When we use string line; while (getline(in,line)) { out.write(line.c_str(),line.size()); out.put('\n'); } in.close();
14
by: Xero | last post by:
Hello. I am using Visual Studio .NET (Academic Edition) to write a VB program. My computer is running Win XP Pro. I am writing a calculator and requires users to enter two numbers. After...
5
by: Sen Haerens | last post by:
I'm using string.split(/^$/m, 2) on a curl output to separate header and body. There’s an empty line between them. ^$ doesn’t seem to work... Example curl output: HTTP/1.1 404 Not Found...
1
by: alain MONTMORY | last post by:
Hello everybody, I am a newbie to python so I hope I am at the right place to expose my problem..... :-http://www.python.org/doc/2.4.2/ext/pure-embedding.html 5.3 Pure Embedding I download the...
7
by: walterbyrd | last post by:
Python's lack of an EOF character is giving me a hard time. I've tried: ----- s = f.readline() while s: .. .. s = f.readline()
4
by: Marek Kubica | last post by:
Hi, I am trying to get this stuff working, but I still fail. I have a format which consists of three elements: \d{4}M?-\d (4 numbers, optional M, dash, another number) EMPTY (the <EMPTYtoken)...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.