473,378 Members | 1,152 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,378 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 1076
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"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.