Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Relative and Absolute Positioning on <div> tags

Status
Not open for further replies.

brbarto

Technical User
Sep 6, 2001
34
0
0
I am using 2 <div> tags within a <div> tag and I am trying to put a border in the outer <div> and it's not working. Instead of a border around the outside, I only get a thick line at the top. I am trying to float the inner <div>s to the left and right using relative positioning on the outer <div> and absolute positioning on the inner <div>s.

Any comments or suggestions would be appreciated.
 

Can you show us what you have so far? Personally, I'd put an ID on the outer DIV, and use CSS to achieve an all-round border:

Code:
#myDiv {
   border: 1px #000000 solid;
}

...

<div id="myDiv">...</div>

Hope this helps,
Dan
 
div.report h3 {
background-image: url(/images/blu-gry-grad.jpg);
background-repeat: repeat-y;
background-position: left;
background-color: #e1e1e1;
border-style: solid;
border-width: 1px;
text-align: center;
margin: 5px 0px;
padding: 2px 0px;
}

<div style="position: relative; border-style: solid; border-width: 1px;">

<div class="report" style="position: absolute; top: 0; left: 0; width: 48%;">
<h3>xxxxxxx</h3>
xxxxxx
</div>

<div class="report" style="position: absolute; top: 0; left: 52%; width: 48%">
<h3>xxxxxx</h3>
xxxxx
</div>

</div>
 
There is nothing in that code that is putting a border around a div.

the style info you have given is putting a border on an "h3" element in a div called "report"

Do it the way Dan suggested.

 
<div style="position: relative; border-style: solid; border-width: 1px;">

I believe this line is equivalent to what was suggested.
 

>> I believe this line is equivalent to what was suggested

Except you are not specifying any colour for the border.

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top