473,795 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Padding is not zero

page: http://reenie.org/test/blockpadding.htm
code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>test</title>
</head>
<body>
<h2 style='padding: 0; border:solid 1px red;'>A bunch of text</h2>
</body>
</html>

Why is there padding in the heading, above and below the text, and how
do I get rid of it ?
Nov 7 '08 #1
8 2887
RW
rodeored schreef:
page: http://reenie.org/test/blockpadding.htm
code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>test</title>
</head>
<body>
<h2 style='padding: 0; border:solid 1px red;'>A bunch of text</h2>
</body>
</html>

Why is there padding in the heading, above and below the text, and how
do I get rid of it ?

That's the body's margin or padding,

try <body style='margin:0 ; padding:0;'>
--
Rob
Nov 7 '08 #2
rodeored schrieb:
page: http://reenie.org/test/blockpadding.htm
code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>test</title>
</head>
<body>
<h2 style='padding: 0; border:solid 1px red;'>A bunch of text</h2>
</body>
</html>

Why is there padding in the heading, above and below the text, and how
do I get rid of it ?
If it were padding it were _inside_ the border. So it's h2's default
probably margin.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Nov 7 '08 #3
On Nov 7, 12:09*am, RW <robwaaijenb... @hotmail.comwro te:
rodeored schreef:
page:http://reenie.org/test/blockpadding.htm
code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
* *<title>test</title>
</head>
<body>
* *<h2 style='padding: 0; border:solid 1px red;'>A bunch of text</h2>
</body>
</html>
Why is there padding in the heading, above and below the text, and how
do I get rid of it ?

That's the body's margin or padding,

try <body style='margin:0 ; padding:0;'>

--
Rob
No its not the baody margin. its padding inside the heading.
Nov 7 '08 #4
On Nov 7, 3:04*am, Johannes Koch <k...@w3develop ment.dewrote:
rodeored schrieb:
page:http://reenie.org/test/blockpadding.htm
code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
* *<title>test</title>
</head>
<body>
* *<h2 style='padding: 0; border:solid 1px red;'>A bunch of text</h2>
</body>
</html>
Why is there padding in the heading, above and below the text, and how
do I get rid of it ?

If it were padding it were _inside_ the border. So it's h2's default
probably margin.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
* * * * * * * * * * * * * * *(Te Deum, 4th cent.)
it is is padding inside the heading. . it is not a margin. it is
padding.
Nov 7 '08 #5

rodeored wrote:
On Nov 7, 3:04 am, Johannes Koch <k...@w3develop ment.dewrote:
>rodeored schrieb:
page:http://reenie.org/test/blockpadding.htm
<body>
<h2 style='padding: 0; border:solid 1px red;'>A bunch of text</h2>
</body>
Why is there padding in the heading, above and below the text, and how
do I get rid of it ?

If it were padding it were _inside_ the border. So it's h2's default
probably margin.

it is is padding inside the heading. . it is not a margin. it is
padding.
No, it is not padding. Inside the borders, that extra space above and
below the text is part of the default line-height - space reserved for
character ascenders (e.g. Ñ) and descenders (y). You may or may not be
able to get rid of it by changing the line-height to something less than
1, but beware that if line wrapping occurs, text may overlap. It will
certainly be harder to read.

--
Berg
Nov 7 '08 #6
In article
<de************ *************** *******@40g2000 prx.googlegroup s.com>,
rodeored <in***@reenie.o rgwrote:
On Nov 7, 12:09*am, RW <robwaaijenb... @hotmail.comwro te:
rodeored schreef:
page:http://reenie.org/test/blockpadding.htm
code:<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
* *<title>test</title>
</head>
<body>
* *<h2 style='padding: 0; border:solid 1px red;'>A bunch of text</h2>
</body>
</html>
Why is there padding in the heading, above and below the text, and how
do I get rid of it ?
That's the body's margin or padding,

try <body style='margin:0 ; padding:0;'>

--
Rob

No its not the baody margin. its padding inside the heading.
As someone else posted, if you are referring to the space between your
red border on h2 and the text inside h2, that is the effect of line
height. If you are referring to space between the red border and the
body (i.e. in this case the top of the view port in the browser window)
it is probably a combination of default margin on the h2 and default
padding on the body.

It is easy to test: did you actually try the suggested changes to
body and h2 (i.e. styling BOTH to have margin: 0; padding: 0;)?

Remember that the margin goes OUTSIDE the border, the padding goes
INSIDE (except, IIRC, in IE's broken quirks-mode box model?)

By the way, semantically speaking, the first header in your body
should be an h1 (first level heading). If this is too big for your
liking, you can always override the browser's default size by
styling it accordingly.

<h1>This is the main heading for the content</h1>
<h2>This is the first section sub-heading</h2>
<h3>This is a subsection sub-heading!</h3>
<p>Etc.</p>
Nov 7 '08 #7
On Nov 7, 6:50*am, Bergamot <berga...@visi. comwrote:
rodeored wrote:
On Nov 7, 3:04 am, Johannes Koch <k...@w3develop ment.dewrote:
rodeored schrieb:
page:http://reenie.org/test/blockpadding.htm
<body>
* *<h2 style='padding: 0; border:solid 1px red;'>A bunch of text</h2>
</body>
Why is there padding in the heading, above and below the text, and how
do I get rid of it ?
If it were padding it were _inside_ the border. So it's h2's default
probably margin.
it is is padding inside the heading. . it is not a margin. it is
padding.

No, it is not padding. Inside the borders, that extra space above and
below the text is part of the default line-height - space reserved for
character ascenders (e.g. Ñ) and descenders (y). You may or may not be
able to get rid of it by changing the line-height to something less than
1, but beware that if line wrapping occurs, text may overlap. It will
certainly be harder to read.

--
Berg
Thanks, that makes sense.
Nov 7 '08 #8
Bergamot wrote:
Inside the borders, that extra space above and
below the text is part of the default line-height - space reserved for
character ascenders (e.g. Ñ) and descenders (y).
That's probably a helpful informal description, but it's not technically
quite correct.

Consider an element like <div>N</divwith border: solid 1px and with
padding not set (or, for definiteness, padding explicitly set to 0). A naive
assumption might be that the border touches "N" both at the top and at the
bottom. But as you note, it turns out that this would be pragmatically all
wrong.

But even if you consider <div>Ñy</div>, you probably see (depending on font
etc.) that there is still some space above the tilde and below the descender
of "y".

Next, if you set line-height: 1 (making line height equal to the size of the
font, i.e. the nominal height of the font), you will see variation: there
might still be spacing, or the tilde or the descender might cross the
border. This is simply a matter of font design.

There is fairly popular belief saying that font size is the overall height
of the font, including ascenders and descenders and diacritic marks. It is
second-best approximation to truth in this matter and surely much better
than most of what we see written about font size. But it really cannot be
the whole truth. A simple proof is that by character code standards,
diacritic marks can be stacked with no pre-set limitation, and apparently
you go out of bounds at _some_ point.

The truth is that font size is a property assigned to the font by the font
designer, normally expected to provide sufficient height for all characters
including the fancy stuff, but the designer may design otherwise. One can
also say that a font designer works inside a square, the em square, and
designs glyphs inside it but not necessary utilizing the full height (and
hardly ever the full width, for Latin letters at least) and, on the other
hand, feeling free to cross the limits occasionally when he decides so. A
typical example is the letter Å, A with a ring above, occurring in
Scandinavian languages. Due to the nature of the ring, the letter very often
extends beyond the "upper limit" of the font - and there might even be
another diacritic, like the acute, above the circle, in some languages.

When you have set line-height: 1 (which I mention for a frame of reference
only - it is almost always too small, but sometimes suitable when you really
know and understand your text and context and their stability) and padding:
0, then there is no space between a border and the font height, though of
course individual letters almost always consume less than the full height of
the font.

And of course, in a more common situation, there are different types of
spacing between, say, your letter "a" and the bottom and top border of the
box where it resides: spacing cause by the fact that "a" is not as tall as
the height of the font; the leading, i.e. spacing caused by line-height
being larger than 1 as it usually is and should be; and padding, if set to a
nonzero value.

--
Yucca, http://www.cs.tut.fi/~jkorpela/

Nov 8 '08 #9

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

Similar topics

6
17881
by: Rowland | last post by:
Hi, I've got a field that stores numeric values, representing a tracking number. I've also got a stored procedure that will extract this field and return it to a client. However, I would like to return it slightly differently to the way in which it is stored. Basically, I want to return it as TRK000nnn - Where TRK is the string "TRK", 000 is zero-padding up to 4 zeros, and nnn is the number itself - results would look something like...
17
29244
by: delerious | last post by:
I'm trying to add some simple padding to an IMG by using a padding-right style, but it doesn't work in IE. Works fine in Mozilla and Opera, though. Here's a link to a page which displays this IE problem: http://home.comcast.net/~delerious1/index12.html I do know that I can solve the problem in IE by changing padding-right to margin-right, but then the links cannot be clicked when the mouse is over that margin area. So I would...
5
5089
by: Marita | last post by:
Hi, I have a page (several) where the top margin doesn't appear to be working. I have this in my code: <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px;
15
17669
by: I wish | last post by:
#include <string.h> int a; memset( a, 0, sizeof(a) ); Does that guarantee all bits zero? -- |
258
8756
by: Terry Andersen | last post by:
If I have: struct one_{ unsigned int one_1; unsigned short one_2; unsigned short one_3; }; struct two_{ unsigned int two_1;
6
2331
by: Army1987 | last post by:
Reliable sources (whose names I'm not allowed to disclose) told me that on the next version of the Deathstation (version 10000, or DS10K) an integral type (they didn't tell which) will have a odd parity bit, that is a bit which is set if an even number of value/sign bits are set, and unset otherwise. If the parity is wrong, the representation is a trap, and they didn't tell me how it is handled (and they won't even have to tell this when...
1
2823
by: Monte Cristo | last post by:
Hi all, I'm having a problem with results being returned from a data source, it's returning the right value but without the zero's "0" in front. I've searched through google for "padding zero's in xpath" and i've only been able to find one thing but I can't tie into my xpath query. Software being used: Infopath 2003 with a Access 2003 Database. My xpath query: xdMath:Max(dfs:dataFields/d:Property/@Claim_Number) + 1 For a little...
6
4286
by: john | last post by:
Many times I have seen padding bits being mentioned here. What is the purpose of the padding bits?
1
2253
by: ags5406 | last post by:
i have a normal label with a fixed width font with no padding... lblsizing.Font {Name = "Lucida Console" Size=12.0} System.Drawing.Font lblsizing.Padding.All 0 Integer but despite the fact that the padding property is set to zero, there is still some bit of (natural) padding that is not adjustable... i can determine this by observing the width of the label while adding additional characters to the text of the label...
6
2844
by: John Messenger | last post by:
I notice that the C standard allows padding bits in both unsigned and signed integer types. Does anyone know of any real-world examples of compilers that use padding bits? -- John
0
10436
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9040
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
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 we have to send another system
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.