Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Stretch a DIV width to match content within...

  • 07-08-2009 10:57AM
    #1
    Moderators, Society & Culture Moderators Posts: 25,619 Mod ✭✭✭✭


    Hi guys,

    I want to have a DIV, of an unfixed width, so that it will stretch to display the content that appears within in. (In this case a video window with a large and small size).

    The video object is in the .playerBorder DIV, which sits within the .playerWrap DIV. The problem is

    (1) If I don't specify a width (as per below), the .playerBorder DIV stretches to 100% of the page regardless of what size object is in it.
    (2) If I specify a width, but allow overflow: visible, the overflow isn't centered like it needs to be.

    Any thoughts, etc, appreciated! :)

    [HTML]<div class="playerWrap">
    <div class="playerBorder">CONTENT THAT CHANGES WIDTH</div>
    </div>[/HTML]

    [HTML].playerWrap{
    margin-left: auto;
    margin-right: auto;
    margin-top: 50px;
    margin-bottom: 0px;
    text-align: center;
    background-color: #99FF33
    }


    .playerBorder {
    background-color: #b3b3b3;
    border-color: #000000;
    border-style: solid;
    border-top-width: 1px;
    border-right-width: 1px;
    border-bottom-width: 1px;
    border-left-width: 1px;
    padding: 0px;
    overflow: visible;
    margin-left: auto;
    margin-right: auto;
    }[/HTML]


Comments

  • Moderators, Society & Culture Moderators Posts: 25,619 Mod ✭✭✭✭Dades


    I had to use a table, btw. ;)


Advertisement