WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > WEB DESIGN > CSS > two divs side by side

Reply
  Thread Tools Display Modes
Old 2nd May 13, 05:54 PM   #1
sirila29
WLC Member
 
Join Date: May 2013
Posts: 4
Default two divs side by side

Hi All,
I have two divs that i need to be aligned side by side and centered.
if i increase the width on the left they should automatically align with a little space in between divs which remain constant.
because i had float left and float right they are always aligned to either side. i changed the float to right but they look like they are to right corner and not centered if width is small.
i wish i could put a pic of what im looking for but not sure how here. this is my first post.
help is greatly appreciated
<!DOCTYPE html>
<html>
<head>
<style>
.right
{
float:right;
width:300px;
margin-left:10px;
background-color:#b0e0e6;
}
.left
{
float:left;
width:250px;
margin-right:10px;
background-color:#b0e0e6;
}
</style>
</head>

<body>
<div class="left">
<p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.</p>
<p>'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.'</p>
</div>
<div class="right">
<p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.</p>
<p>'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.'</p>
</div>
</body>
</html>
thanks
Sirila
sirila29 is offline   Reply With Quote
Old 2nd May 13, 09:56 PM   #2
meesa
WLC Mod
 
meesa's Avatar
 
Join Date: Jul 2009
Location: Milky Way Galaxy
Posts: 3,716
Default Re: two divs side by side

Use a site like imgur so I can better understand what you're looking to do.
__________________
Praise be to the Lord God for the ability to learn, the capability to analyze, and the time to help users on this forum.
meesa is offline   Reply With Quote
Old 3rd May 13, 03:55 PM   #3
sirila29
WLC Member
 
Join Date: May 2013
Posts: 4
Default Re: two divs side by side

http://i.imgur.com/dbDWUcP.png?1
is the url for the divs.
thank you Meesa for the suggestion.
in that picture if you see i have the divs side by side
the space in between the two divs should be the same. if i increase the width of the left image it should increase to the left
sirila29 is offline   Reply With Quote
Old 3rd May 13, 11:07 PM   #4
meesa
WLC Mod
 
meesa's Avatar
 
Join Date: Jul 2009
Location: Milky Way Galaxy
Posts: 3,716
Default Re: two divs side by side

So basically, as a text mockup. You want two DIVs at 100px width, and 10px between them. If DIV one expands to 150px, then DIV two contracts to 50px?
__________________
Praise be to the Lord God for the ability to learn, the capability to analyze, and the time to help users on this forum.
meesa is offline   Reply With Quote
Old 6th May 13, 02:28 PM   #5
sirila29
WLC Member
 
Join Date: May 2013
Posts: 4
Default Re: two divs side by side

Yes exactly thats what i needed.thank you for looking into this
sirila29 is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:52 AM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyrightę 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.