473,395 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

margin-top in FF versus IE

Hi -

In lieu of easily centering text vertically in a <div>, I am trying to
use margin-top to shove the text down. I have created a <div> wrapper
and put a <p> tag in it and am trying to format the <p>.

My understanding is that the browsers different interpretations of
width also affect how they treat height so I'm doing the margin on the
<p> instead of on the <div>. The following does what I want in IE but
not in FF which from what I've read suggests something is wrong in the
code.

I appreciate any suggestions -
Thanks!
Andrea

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<style type="text/css">
#wrapper {height: 160px; background-color: gray;}
#wrapper p {margin-top: 50px; text-align: center; background-color:
blue;}

</style>
</head>

<body>
<div id="wrapper">
<p>Text in the p in the div, want to see if I can format the margins
properly.</p>
</div>

</body>
</html>

Dec 2 '05 #1
4 1586
"Andrea" <am*****@yahoo.com> wrote:
In lieu of easily centering text vertically


http://www.student.oulu.fi/~laurirai/www/css/middle/

--
Spartanicus
Dec 2 '05 #2
Thanks for the link. I think I'm still not understanding something,
though, as I'm having trouble getting the "Vertical centering using
margins" to work the same on IE as FF.

Spartanicus wrote:
"Andrea" <am*****@yahoo.com> wrote:
In lieu of easily centering text vertically


http://www.student.oulu.fi/~laurirai/www/css/middle/

--
Spartanicus


Dec 2 '05 #3
Also, I went to the complext cases, "Common code of examples" and tried
the following (pasted from the example given) and it's still not
properly centering vertically. Have you found a method to be
successful for you?

Thanks,
Andrea

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<style type="text/css">
..text, .image, .block /* All container divs*/
{width:14em;height:8em;margin:0.5em;
border:thick solid;background:#fff;}

..block div {border:dashed;width:10em;} /* to make it more interesting*/
</style>
</head>

<body>
<div class="block">
<div> Block element, with long enough content to wrap.
</div>
</div>
</body>
</html>
Spartanicus wrote:
"Andrea" <am*****@yahoo.com> wrote:
In lieu of easily centering text vertically


http://www.student.oulu.fi/~laurirai/www/css/middle/

--
Spartanicus


Dec 2 '05 #4
Please don't top post, corrected this once.

"Andrea" <am*****@yahoo.com> wrote:
>In lieu of easily centering text vertically
http://www.student.oulu.fi/~laurirai/www/css/middle/

Also, I went to the complext cases, "Common code of examples" and tried
the following (pasted from the example given) and it's still not
properly centering vertically.
Take the time to read and understand the resource instead of skimming it
looking for a shortcut.
Have you found a method to be
successful for you?


I haven't looked at your example, and I don't know the quoted resource,
but it is written by a CSS expert and sure to contain good information.

If you want people to look at you code it's best to upload it and
provide the url instead of posting the code.

--
Spartanicus
Dec 3 '05 #5

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

Similar topics

1
by: Tony Benham | last post by:
I'm having problems with a css layout where a margin is being inserted with the wrong width. I believe it's my css that's at fault since it is wrong in netscape 7.1, opera,7.11 and IE6 but I cannot...
4
by: Harlan Messinger | last post by:
What is *supposed* to be the way to specify the horizontal offset of (a) the list item's marker and (b) the list item's content? In particular, see ...
3
by: Brian | last post by:
I have a page with content, navigation, and footer divs, in that order. The nav div has position: absolute, width 8em, on green background. The other divs have an 8em green left border, such that...
26
by: meltedown | last post by:
I have 2 left floating divs on a page. Sometime the left side is larger, sometimes the right side is larger. I want the page to have a margin at the bottom of whichever div is the largest. If I...
3
by: Luciano A. Ferrer | last post by:
this is really strange... I cant find what is wrong... so, #botonera have a left margin of 18px, but IE make it 36px! If I put a margin of 30px, IE make it 60px! I am crazy? <!DOCTYPE html...
1
by: Jeremy | last post by:
Let's say I have some block elements that self-organize by floating to the left, so if no more blocks can fit in a row they begin on the next row (see crummy ASCII art at end of message). I...
11
by: Pablito | last post by:
Hi at all into a page I wrote <style> body {margin-left:10%;margin-right:10%;text-align:justify;} </style> reading the page with FireFox the margin left is 10% but the right is 0% Why? How can...
2
by: Steve Richter | last post by:
I want my panel to have an inner margin. Problem is label text does not appear to recognize the margin. In this example, the TextBox aligns on the margin, the label does not: <asp:Panel...
5
by: Neviton | last post by:
Hi this is the html to generate the behavior: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
7
by: GTalbot | last post by:
Hello fellow authoring.stylesheets colleagues, Can someone please explain why the bottom margin of the last inflow block-level child in an overflowed parent should not have its margin reachable....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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,...
0
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...

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.