Jump to content


[CSS] Div Ligning


4 replies to this topic

#1 Robbie.Knox

    Young Padawan

  • Members
  • Pip
  • 42 posts

Posted 12 June 2007 - 09:04 AM

Ok I have this code:

<div class="header">
	<div class="button">
	
	</div>
	<div class="button">
	
	</div>
</div>

With this CSS:

.header {
width: 100%;
height: 254px;
background-image: url(images/headerbg.jpg);
background-repeat: repeat-x;
}

.button {
width: 113px;
height: 41px;
background-image: url(images/button_transparent.gif);
background-repeat: no-repeat;
padding-right: 30px;
}

So as you can see I want to display two buttons horizontally (eventually I want to add more) with a gap of 30px between them, inside a Div called header.

How can I avoid this happening?

Posted Image

I've tried display: inline; but then the buttons just disappear.

Any help?

Thanks

Rob

Edited by Robbie.Knox, 12 June 2007 - 09:42 AM.


#2 albinoAZN

    Albinos Are Extinct!!!

  • Members
  • PipPipPipPip
  • 1,139 posts
  • Gender:Male
  • Location:Mississippi, USA

Posted 12 June 2007 - 10:23 AM

change the .button class to this
.button {
width: 113px;
height: 41px;
background-image: url(images/button_transparent.gif);
background-repeat: no-repeat;
margin-right: 30px;
float:left;
}

basically all I did was add float:left, and changed padding to margin

#3 Robbie.Knox

    Young Padawan

  • Members
  • Pip
  • 42 posts

Posted 13 June 2007 - 10:38 AM

Thank you! :P

#4 albinoAZN

    Albinos Are Extinct!!!

  • Members
  • PipPipPipPip
  • 1,139 posts
  • Gender:Male
  • Location:Mississippi, USA

Posted 13 June 2007 - 05:13 PM

no problem buddy :D

#5 Will0wz

    Jedi In Training

  • Members
  • PipPip
  • 348 posts
  • Gender:Male
  • Location:Shed

Posted 13 June 2007 - 05:16 PM

Isn't P2L just so sweet and romantic :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users