Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 611715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:48:52+00:00 2026-05-13T17:48:52+00:00

So I’m really trying to use divs exclusively, as opposed to using tables for

  • 0

So I’m really trying to use divs exclusively, as opposed to using tables for layout purposes, but I’m still getting stuck here and there. Today I have one of those cases.

Consider the following markup:

<div style="width:943px;margin:0px auto;height:auto">
    <div style="display:block;clear:both">
        <div style="float:left;display:block-inline;clear:none;background:url(tl.png);width:26px;height:25px"></div>
        <div style="float:left;display:block-inline;clear:none;background:url(t.png) repeat-x;width:865px;height:25px"></div>
        <div style="float:left;display:block-inline;clear:none;background:url(tr.png);width:26px;height:25px"></div>
    </div>
    <div style="height:auto;display:block;clear:both">
        <div style="float:left;width:26px;display:block-inline;clear:none;background:url(l.png) repeat-y;width:26px;height:100%"></div>
        <div style="padding:0 15px;height:100%;float:left;width:835px;display:block-inline;background:#FFF;clear:none;">
            <br />
            Some text heeere.
            <br />
            Some more text heeere.
        </div>
        <div style="float:left;width:26px;display:block-inline;clear:none;background:url(r.png) repeat-y;width:26px;height:100%"></div>
    </div>
    <div style="display:block;clear:both">
        <div style="float:left;display:block-inline;clear:none;background:url(bl.png);width:26px;height:25px"></div>
        <div style="float:left;display:block-inline;clear:none;background:url(b.png) repeat-x;width:865px;height:25px"></div>
        <div style="float:left;display:block-inline;clear:none;background:url(br.png);width:26px;height:25px"></div>
    </div>
</div>

Now this is what’s its doing:

alt text

Note that it’s going slightly past the page height.

This is what I want it to do:

alt text

I want it to fluidly “fit” to the text without me specifying a height. It seems that the problem lies with the two side divs that won’t work unless you specify the height as 100%. Is there maybe another/easier way to do this?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T17:48:52+00:00Added an answer on May 13, 2026 at 5:48 pm

    You asked for it, so here goes. This is my hand crafted, cross-browser, standards-compliant method of doing image borders on flexible containers.

    I’ve assumed an image border size of 16px here, you will need to adjust this to suit. Also, for clarity in the absense of images I have added borders. Thse should be removed, obviously.

    Demo.

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset=utf-8 />
    <title>Borders</title>
    <style>
    .outer {
        position:relative;
        float: left;
        border: 1px solid blue
    }
    .inner {
        border: 1px solid green
    }
    .tl, .tm, .tr, .ml, .mr, .bl, .bm, .br {
        border: 1px solid red;
        margin: 0;
        padding: 0;
    }
    .tm, .bm, .tl, .tr, .bl, .br {
        height: 16px
    }
    .tl, .tr, .bl, .br {
        width: 16px
    }
    .tm, .bm {
        height: 16px;
        margin: 0 0px
    }
    .tm {
        background-repeat:repeat-x;
        margin: 0 16px
    }
    .bm {
        background-repeat:repeat-x;
        margin: 0 16px
    }
    .tl {
        position: absolute;
        top: 0;
        left: 0;
    }
    .tr {
        position: absolute;
        top: 0;
        right: 0;
    }
    .bl {
        position: absolute;
        left: 0;
    }
    .br {
        position: absolute;
        right: 0;
    }
    .ml {
        padding-left: 16px;
        background-repeat:repeat-y
    }
    .mr {
        padding-right: 16px;
        background-repeat:repeat-y;
        background-position: 100% 0
    }
    </style>
    </head>
    <body>
    <div class="outer">
        <div class="tm">
            <div class="tl"></div>
            <div class="tr"></div>
        </div>
        <div class="ml">
            <div class="mr">
                <div class="inner">
                    <h2>Lorem</h2>
                    <p>Ipsum dolor</p>
                </div>
            </div>
        </div>
        <div class="bm" >
            <div class="bl"></div>
            <div class="br"></div>
        </div>
    </div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am trying to loop through a bunch of documents I have to put
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.