473,811 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

padding and margin units

Hello,

I always use EM for text size, letter spacing and line heights.
For DIV widths I usually use PIXELS if fixed width web site and
PERCENT if fluid layout web site.

I think in both cases I am doing the right thing ... I think.

But what unit should I use for padding and margin? EM? PIXEL?

Thanks,
Miguel
Jun 27 '08 #1
5 3187
In article
<19************ *************** *******@b64g200 0hsa.googlegrou ps.com>,
shapper <md*****@gmail. comwrote:
Hello,

I always use EM for text size, letter spacing and line heights.
You should at least stop doing this in the case of line-height.
For DIV widths I usually use PIXELS if fixed width web site and
PERCENT if fluid layout web site.

I think in both cases I am doing the right thing ... I think.
If you use fixed width of px for a div and the content is wider than the
div, it will look ugly and/or broken
But what unit should I use for padding and margin? EM? PIXEL?
It depends on the context. Post a url of something you are unsure about.

--
dorayme
Jun 27 '08 #2
Scripsit shapper:
I always use EM for text size, letter spacing and line heights.
Good for you and your visitors, if you use reasonable values. However,
line-height is best set as a pure number, for inheritance-related
technical reasons.
For DIV widths I usually use PIXELS if fixed width web site
Why would you suddenly spoil everything and set a fixed width in pixels?
Suppose you set a width of 800 pixels; how many characters will fit in,
horizontally? The only correct answer is "I don't know" or "It depends".
But what unit should I use for padding and margin? EM? PIXEL?
The answer is obvious if you think _why_ you use the em unit for text
size and related matters, assuming you understand the reason and aren't
just following some guideline without knowing why.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 27 '08 #3
On May 6, 2:05 am, dorayme <doraymeRidT... @optusnet.com.a uwrote:
In article
<195ae751-1de2-43f6-b81a-a3b90e07f...@b6 4g2000hsa.googl egroups.com>,

shapper <mdmo...@gmail. comwrote:
Hello,
I always use EM for text size, letter spacing and line heights.

You should at least stop doing this in the case of line-height.
For DIV widths I usually use PIXELS if fixed width web site and
PERCENT if fluid layout web site.
I think in both cases I am doing the right thing ... I think.

If you use fixed width of px for a div and the content is wider than the
div, it will look ugly and/or broken
But what unit should I use for padding and margin? EM? PIXEL?

It depends on the context. Post a url of something you are unsure about.

--
dorayme
"You should at least stop doing this in the case of line-height."

Yes, I understood that one hour ago. It also seems the CSS validator
has some problems with unitless values so I need to use 1.0 instead of
1.

Thanks,
Miguel
Jun 27 '08 #4
On May 6, 7:22 am, "Jukka K. Korpela" <jkorp...@cs.tu t.fiwrote:
Scripsit shapper:
I always use EM for text size, letter spacing and line heights.

Good for you and your visitors, if you use reasonable values. However,
line-height is best set as a pure number, for inheritance-related
technical reasons.
For DIV widths I usually use PIXELS if fixed width web site

Why would you suddenly spoil everything and set a fixed width in pixels?
Suppose you set a width of 800 pixels; how many characters will fit in,
horizontally? The only correct answer is "I don't know" or "It depends".
But what unit should I use for padding and margin? EM? PIXEL?

The answer is obvious if you think _why_ you use the em unit for text
size and related matters, assuming you understand the reason and aren't
just following some guideline without knowing why.

--
Jukka K. Korpela ("Yucca")http://www.cs.tut.fi/~jkorpela/
Yes, I understand the reason ... with EM when text size increases so
it will the padding and margin.

About the fluid versus fixed ... in the web site I am building I have
two requirements:

1. The web site has a flash movie which should expand all width of the
layout.
To be honest I don't know if a Flash movie should be expanded or
not.

2. The web site must display flash papers documents online.
I need to display the Flash Paper documents with at least 800px
width.
Again I also don't know if I should make the design fluid with
Flash documents in it.

These are the reasons why I am using Fixed Layout instead of Fluid
Layout.
Not sure if I am taking the right option but ...

Anyway, any suggestion is welcome.

I have been always reading about Elastic layouts. Does everyone use
it?

Thanks,
Miguel
Jun 27 '08 #5
Scripsit shapper:
"You should at least stop doing this in the case of line-height."
You're supposed to quote just the relevant part, instead of a fullquote
_and_ a quotation of the relevant part. Google for "how I quote on
Usenet".
Yes, I understood that one hour ago.
OK. What were we supposed to get from this information?
It also seems the CSS validator
has some problems with unitless values so I need to use 1.0 instead of
1.
What? You seem to have misunderstood something completely. Changing
values in your style sheet just to deal with an assumed CSS Validator
bug is perverse.

Then again, if this is still about line-height, then 1.0 is almost
always too small for any normal text, but so is 1.1, except perhaps for
fonts like Calibri that utilize, on average, a fairly small part of the
height of the font.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 27 '08 #6

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

Similar topics

17
29247
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...
9
4209
by: Paul McKenna | last post by:
Hello Here is my code: <div> <span> ... Flash object... </span> <span> <img src="a.gif">
7
8837
by: Gustaf Liljegren | last post by:
I continued on the example shown earlier today: http://gusgus.cn/test/index.html Now I get some unwanted space in Firefox (the red space just below the first image) which doesn't appear in IE6. I've double-checked the CSS for any padding or margings than may cause it, but have found none. How can I remove it? Thanks,
11
2480
by: muraii | last post by:
Hi all, I've trolled through Google, a little of evolt, css-discuss archives, and sent the list a request, all to no avail. I consulted positioniseverything.net and quirksmode.org. The issue I have seems simple enough that I'd have turned it up on any of those sources, but, alas, that's not the case. So, please refer to
36
3056
by: phil-news-nospam | last post by:
Here is a simpler (no drop shadows) example of the padding bug I see: http://phil.ipal.org/usenet/ciwas/2006-05-08/buttons-1.html So far I find nothing in the CSS2 document that says I should get this kind of inconsistent result. -- ----------------------------------------------------------------------------- | Phil Howard KA9WGN | http://linuxhomepage.com/ http://ham.org/ |
10
12913
by: Alan Silver | last post by:
Hello, In my (seemingly) endless quest to understand CSS, I have yet another problem. Please look at http://www.kidsinaction.org.uk/ph/x.html in Opera, where you will see it how I expected. If you look at it in IE (6 or 7), you find it also looks fine, except for the top margin missing from the links across the top of the page. That's not the main issue here, but any pointers as to why it doesn't show them would be appreciated.
11
6880
by: sllrphoto | last post by:
A veteran of early html, I've modified my blog template and made it look rather clean (albeit rather plain) when viewed with IE. Ironically, I'm a big Firefox fan, but when viewed in FF, my blog leaves a lot to be desired. The blog (which is at http://lazycomic.blospot.com/ ) is a basic two column style, with the right column being the one that's giving me the problems.
19
6482
by: Edward | last post by:
Why is it when I have a DOCTYPE line in my HTML then "margin" and "padding" are ignored? This happens in both inline and stylesheet styles. It happens for both XHTML and HTML doctypes. It happens in IE6, IE7 and Firefox (didn't try any others). And when you save the page, the margin/paddings are actually REMOVED from the saved HTML file (!). Why is this?
8
2891
by: rodeored | last post by:
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>
0
9731
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10651
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
10393
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
10405
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
9208
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...
0
6893
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5556
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...
0
5697
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3020
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.