+ Reply to Thread
Results 1 to 2 of 2

Thread: CSS Width

  1. #1
    devongovett is offline x10Hosting Member devongovett is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    33

    Question CSS Width

    Hello,

    I would like to set the width of an html element to be 100% of the width of its contents. This will mean that it will be bigger than its parent element.

    Here is the html:

    Code:
    <div id="items">
        <ul>
            <li><img src="sample.png"></li>
            <li><img src="image.jpg"></li>
            ...
        </ul>
    </div>
    And the CSS:

    Code:
    #items{
        width: 100%; //full browser window
        overflow: hidden;
    }
     
    #items ul li{
        list-style-type: none;
        float: left;
        margin-right: 20px;
    }
     
    #items ul{
        //I want the width of this element to be the full width 
        of all of the images in the list, no matter how wide the 
        parent element is.  Right now the images wrap to a 
        new line.
    }
    Can I do this with CSS, or do I have to use Javascript/jQuery?

    Thanks for your help!
    Devon

  2. #2
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: CSS Width

    A child cannot be bigger than it's parent... sorry!
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

+ Reply to Thread

Similar Threads

  1. help!!!!!
    By lordsofvine in forum Programming Help
    Replies: 1
    Last Post: 10-15-2008, 05:00 AM
  2. can anyone convert a CSS into an IPB skin for me?
    By leafypiggy in forum Programming Help
    Replies: 0
    Last Post: 05-06-2008, 07:41 PM
  3. Scrollbar width..?
    By DecemberGuild in forum Scripts & 3rd Party Apps
    Replies: 0
    Last Post: 11-07-2006, 07:08 PM
  4. CSS problem.. fine in IE not in Opera
    By Cynical in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 07-21-2006, 03:17 PM
  5. Weird problem width apache handlers
    By cetutnx1 in forum Free Hosting
    Replies: 6
    Last Post: 01-03-2006, 10:39 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers