Positioning divs left and right within anohter div

30,538

I hope this will help. CSS:

#left, #right {
 width: 100px; //change this to whatever required
 float: left;
}

HTML :

<div id="wrapper">
    <div id="left">
       <p class="t0">lorum itsum left</p>
    <div>
    <div id="right">
       <p class="t0">lorum itsum right</p>
    <div>
<div>
Share:
30,538
RLoniello
Author by

RLoniello

I love programming, developing solutions that improve people's life is a passion of mine. I've been a member of Stack Overflow nearly since the start. I try to provide quality content that inspires and motivates! Disclaimer: Since April 28th 2018 I have worked for Apple Inc. My Opinions, Programming style and methods should not be taken as canon or as a statement or opinion from Apple. All software development I do is on my own free time using publicly available information for my own enjoyment. Any software I release should not be taken as promise of future features, design or behavior supported by Apple.... Nope, Apple did not make me write this.

Updated on July 09, 2022

Comments

  • RLoniello
    RLoniello almost 2 years

    I am quite new to css and html, and I am having trouble floating divs within a another div, I've done quite a bit of research online but have not been able to come up with a solution.

    these are the sites I have read and where of no use:

    barelyfitz /screencast/html-training/css/positioning/

    stackoverflow /questions/580195/css-layout-2-column-fixed-fluid

    mirificampress /show.php?id=106

    How to get Floating DIVs inside fixed-width DIV to continue horizontally?

    My code can be found on jsFiddle here

    • kinakuta
      kinakuta about 12 years
      Make sure you're closing your tags properly. Your divs don't have the correct closing tags, and hence they're not wrapping your content like I believe you expect them to.
    • RLoniello
      RLoniello about 12 years
      I removed floats to try something I found at positioniseverything.net/easyclearing.html
  • RLoniello
    RLoniello about 12 years
    KinaKuta was correct, sigh the correct and simple way can be found at jsfiddle.net/CCAtj
  • RLoniello
    RLoniello about 12 years
    I just found Stackoverflow, you guys are wonderful, now to get a editor instead of doing every thing with notepad... Good historical reference though for other noobs. Special thanks to KinaKuta and xFortyFourx