Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2005
    Posts
    550

    Can't wrap a DIV around 2 floating div

    PHP Code:
    <div bgcolor:blue>
    <
    div float:left width:30%></div>
    <
    div float:left width:70%></div>
    </
    div
    ignore the incorrect html syntax.

    basically, i have 2 floating divs. mimicing 2 columns in a row.

    So just like how you would highlight a row by <tr bgcolor:blue>

    i want to highlight the floating divs too.

    <div bgcolor:blue> DOES NOT WRAP around the 2 floating divs. Instead, it lies ABOVE the 2 divs.

    What is the right way to wrap the 2 floating div so i can highlight them?
    Last edited by grabmail; 05-19-2006 at 11:34 PM.

  2. #2
    Join Date
    May 2006
    Location
    Bantam, CT
    Posts
    114
    First you need to give your div's an id or a class. Seeing as you have three that you want to uniquely style you would want an id.

    Code:
     
    <div id="outter">
    <div id"innerleft></div>
    <div id="innerright"></div>
    </div>
    Than you can syle it in a external style sheet like this.

    Code:
     
    #outter {background-color: #f00;} /* Red */
    #innerleft {background-color: #0f0;} /* Green */
    #innerright {background-color: #00f;} /* BLue */
    Once you float an element you take it out of the document structure. So you would have to give your floated div's a height style and then you would need to clear those floats to make them behave.



    JBelthoff
    • Hosts Station is a Professional Asp Hosting Provider
    • Position SEO can provide your company with SEO Services at an affordable price
    › As far as myself... I do this for fun!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •