Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS getting things to not shift others 1

Status
Not open for further replies.

DaRNCaT

Technical User
Dec 18, 2002
566
NZ
How do I stop nested <p>, <div>, <span> elements shfting other elements

I have created a footer, logo to the left, text in the middle, logo to the right, but the text isn't sitting centered (it's slightlly too far to the right, and the right hand logo has been pushed downwards by about 30px

css code (margins are set to minus to get the images to sit half over the box above.)
Code:
.bottombox {
    
    width: 762px;
    height: 100%;
    position: static;
    margin: 0 auto; /* meaning top and bottom margins are 0, left and right are auto, which centers the box in standard browsers */

}
.aaleft {
	float: left;
	height: 60px;
	width: 125px;
	margin-top: -30px;



}
.aaright {
	float: right;
	height: 100px;
	width: 101px;
	margin-top: -66px;



}
.footertext {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: x-small;
	color: #000000;

}

page code for footer

Code:
<div class="bottombox">
<img src="images/logo1.gif" alt="Tourisim Logo" width="125" height="60" class="aaleft">
<span class="footertext"><a href="home.php">Home</a> :: <a href="#">Book
Online</a> :: <a href="location.php">Location</a> :: <a href="attractions.php">Local Attractions</a><br>
&copy; Motel Invercargill, 2004<br>
Design by </span>
<img src="images/rewardslogo.gif" alt="AA Rewards Logo" width="101" height="100" class="aaright">
</div>

thanks.

----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
This looks somewhat ok to me:
Code:
<style type="text/css"> 
.bottombox {
    text-align: center;
    width: 762px;
    height: 100%;
    position: static;
    margin: 0 auto;
}
.aaleft {
    float: left;
    height: 60px;
    width: 125px;
}
.aaright {
    float: right;
    height: 100px;
    width: 101px;
}
.footertext {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: x-small;
    color: #000000;
}
</style>
<div class="bottombox">
  <img src="images/logo1.gif" alt="Tourisim Logo" width="125" height="60" class="aaleft" />
  <img src="images/rewardslogo.gif" alt="AA Rewards Logo" width="101" height="100" class="aaright" />
  <span class="footertext"><a href="home.php">Home</a> :: <a href="#">Book
Online</a> :: <a href="location.php">Location</a> :: <a href="attractions.php">Local Attractions</a><br>
&copy; Motel Invercargill, 2004<br>
Design by </span>
</div>
 
Brilliant!
I thought you had to put things in as they occour, I didn't realise that this causes problems, thats probably the problmes on the rest of the page I'm having.
Thanks so much!

----------------------------------------
Sometimes, when my code just won't behave, I take it outside and make it listen to britney spears music, and when it comes back it's really well behaved. I wonder if it's suffering from post tramatic stress syndrome now..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top