473,388 Members | 1,492 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,388 software developers and data experts.

Unintentional Nesting?

Hey all,

I centered a image in the middle of the page using this code, works great:

Expand|Select|Wrap|Line Numbers
  1. .header img {
  2.   margin: 0px 0px 0px 0px;
  3.   position: absolute;
  4.   left: 50%;
  5.   margin-left: -300px;
  6.   top: 50%;
  7.   margin-top: -300px;
  8.   border: 1px solid #660000; 
  9.   }
  10.  
So then, I want to display a line of text underneath it, so that stays centered underneath the header image. I thought this code would work, but it doesn't,

Expand|Select|Wrap|Line Numbers
  1. .contact p {
  2.   margin: 0px 0px 0px 0px;
  3.   position: absolute;
  4.   left: 50%;
  5.   margin-left: -300px; 
  6.   top: 70%;
  7.   margin-top: -300px; 
  8.   }  
It seems like even though I have closed out the first div, and moved onto a different div the browsers are still trying to put the text inside the first div, on top of the image? Why would it do that?? The first div is closed out.

Here is my HTML

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>List Enterprises</title>
  4. <link href="style.css" rel="stylesheet" type="text/css">
  5. </head>
  6.  
  7. <body>
  8. <div class="header"><img src="center.jpg"></div>
  9. <div class="contact"><p>contact info: Trevor List | <a href="mailto:trevor@listenterprises.com">trevor@listenterprises.com</a> | 614.563.5789</p></div>
  10.  
  11. </body>
  12. </html>
Aug 15 '07 #1
2 1078
drhowarddrfine
7,435 Expert 4TB
Remember that absolutely positioned elements are removed from the normal flow and are positioned relative to the next positioned element. <body> in this case. So if both divs were positioned at top:0, they would overlap.

Also, you have multiple positioning for the same element. You set margins to zero but then immediately give them a negative margin. You also set top to some number like 50% but that's going to throw things way off to the side. (haven't played with this).
Aug 15 '07 #2
Thanks, that helps some.

Is there any way for me to make the contact information relative to the bottom of the picture?

Here is the site BTW -

http://listenterprises.com/

As you can see, my contact info is all over the place.
Aug 15 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Michael Hertz | last post by:
I have hundreds of samples of XML documents on my harddisc. But all of them lack the one or another feature of XML. Some XML documents have no attributes some others are rather flat (nesting...
0
by: Wolfgang Schwanke | last post by:
Dear usenet, I'm having the following small problem. I've been ask to add some Quicktime panoramas to a website. The author of the panoramas has made two versions of each: One in MOV format,...
8
by: CoolPint | last post by:
I read in books that nested class cannot access private members of nesting class and vice versa unless they are made friends. Somehow, my compiler is letting my nested class member functions access...
8
by: Hardrock | last post by:
I encountered some difficulty in implementing dynamic loop nesting. I.e. the number of nesting in a for(...) loop is determined at run time. For example void f(int n) { For(i=0; i<=K; i++)...
5
by: jack | last post by:
Hi I wanna know if nesting of tags inside similar tags is possible in XML. To be more clear, is <person> <son> <person>
4
by: kl.vanw | last post by:
I would like to count the nesting level in template classes. How can I make the following work? #include <assert.h> template <class T> class A { public: A() { // what goes here?
12
by: TristaSD | last post by:
Hi, Here's a nice footer I get inside every php page I write in wwwroot on my server. The code gets parsed just fine. I installed php5.2-win32 under W2K Server, IIS 5.0. I've installed php on...
6
by: stephen.cunliffe | last post by:
Hi, I'm looking for opinion/facts/arguments on the correct nesting of UL, OL, & LI elements. For example, this is what I want (unordered list): * Item 1 * Item 2 * Item 3
17
by: henry | last post by:
Folks Here's a skeleton, generic HTML page, call it "index.php". You'll see a bit of php code in the middle: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...

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.