Jump to content


Help with CSS align


5 replies to this topic

#1 xis

    Young Padawan

  • Members
  • Pip
  • 191 posts
  • Gender:Male
  • Location:Los Angeles, Ca.

Posted 30 March 2007 - 06:16 PM

Hey everyone. Long time.

I was wondering if there is a way for me to line up the boxes labled box 1 box 2 and box3
on this page. http://5starconcierge.com/dev/

Can't get it so it works on FF and IE or even get it to aling evenly at all for that matter.


Thanks in advance,
X

#2 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 30 March 2007 - 07:57 PM

#box1 {
float:left;
color:#333;
border:1px solid #ccc;
background:#F2F2E6;
width:150px;
height:150px;
margin:5px;
padding:5px;
}

#box2 {
float:right;
color:#333;
border:1px solid #ccc;
background:#F2F2E6;
width:150px;
height:150px;
margin:5px;
padding:5px;
}

#box3 {
float:right;
color:#333;
border:1px solid #ccc;
background:#F2F2E6;
width:150px;
height:150px;
margin:5px;
padding:5px;
}
<div id="box1">box 1</div>
<div id="box2">box 2</div>
<div id="box3">box 3</div>

You'll notice Box's 2 and 3 are closer to the right. Check out the 'float' variable in the CSS.

#3 xis

    Young Padawan

  • Members
  • Pip
  • 191 posts
  • Gender:Male
  • Location:Los Angeles, Ca.

Posted 30 March 2007 - 08:06 PM

I tried different things with the float and wasn't able to get to work. Do you know the answer?

Edited by xis, 30 March 2007 - 08:06 PM.


#4 Hayden

    P2L Jedi

  • Members
  • PipPipPip
  • 716 posts
  • Gender:Male
  • Location:Texas

Posted 30 March 2007 - 08:44 PM

my last post is the jest of what it is.

take what is in the first code box and paste it in between style tags and take the 2nd code box and paste it in between the body tags.

just play with left and right on float.

#5 Stewie

    Young Padawan

  • Validating
  • Pip
  • 14 posts

Posted 30 March 2007 - 10:50 PM

add all of the boxes into one div container, then make the boxes left: auto and right: auto and margin: auto;

if auto doesnt work then try inherit

O but make sure that the container you put them in takes up that space that all three boxes are in, then css should automatically center them within the big box.

#6 xis

    Young Padawan

  • Members
  • Pip
  • 191 posts
  • Gender:Male
  • Location:Los Angeles, Ca.

Posted 30 March 2007 - 11:40 PM

Looks like I got it to work from what I can tell. Thank you both for taking the time to respond.

I ended up just tweaking the margins for the middle box and it seems to be working here's the code if anyone is interested for future reference.

CSS
#box1 {
float:left;
color:#333;
border:1px solid #ccc;
background:#F2F2E6;
width:150px;
height:150px;
margin:0 0 0 1px;
padding:5px;
}

#box2 {
float:left;
color:#333;
border:1px solid #ccc;
background:#F2F2E6;
width:150px;
height:150px;
margin:0 0 0 35px;
padding:5px;
}

#box3 {
float:right;
color:#333;
border:1px solid #ccc;
background:#F2F2E6;
width:150px;
height:150px;
margin:auto;
padding:5px;
}

HTML
<div id="box1">box 1</div>
<div id="box2">box 2</div>
<div id="box3">box 3</div>

Edited by xis, 30 March 2007 - 11:40 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users