| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Master pages and DIV width problem
Hi,
I'm having a problem where in a master page my layout is something like <div id=header style=height=100px> </div> <div style=position:absolute;width=250px;top:100px> </div> <div style=position:absolute;left:250px;width=250px;top :100px> <asp:contentPlaceholder></asp:contentPlaceholder> </div> And in a webpage that uses the above master page, i have a <div id=main style=width:100%> </div> As a result the width of div#main is actually 100%+250px. This problem happens in IE but not firefox. Does anyone know of a workaround for this problem? It's been frustrating me for the last 2 days. Cheers, Sean |
|
#2
|
|||
|
|||
|
O, the other thing is that is there a solution without employing the use of tables as I just want to use DIVs for my layouts.
|
|
#3
|
|||||
|
|||||
|
I'm surprised any of your styles are rendered.
html Code:
See if that helps.
__________________
ShepherdWeb :: Charging Rhino Wizard I know of no more encouraging fact than the unquestionable ability of man to elevate his life by conscious endeavor. {Henry David Thoreau} § shepherdweb.com § fariswheel productions § reagan administration |
|
#4
|
||||
|
||||
|
by the way, div elements are rendered as width: 100% by default.
|
|
#5
|
|||
|
|||
|
Thanks for the reply. Ok, oops about the '=' but was a typo on my side. The problem I'm trying to fix is the 100%+250px width in the content pages.
To recreate this problem, create a master page, eg. test.master with <div id=header style=height:100px> </div> <div style=position:absolute;width:250px;top:100px> </div> <div style=position:absolute;left:250px;width:250px;top :100px> <asp:contentPlaceholder></asp:contentPlaceholder> </div> Then Default.aspx with test.master as the master page and <div id=main style=width:100%> <table width=100% style=bgcolor:#eeeeee> <tr><td>hi</td></td> </table> </div> and you'll see what i mean. (I'm assuming here you know how to create a master page and referencing a master page from a webform) |
|
#6
|
||||
|
||||
|
Do you also have a stylesheet? Margin and Padding can add width to a div element.
Try removing width: 100% from your div, it shouldn't be necessary. Another consideration is this: You've used position: absolute on all your containers in the masterpage. I haven't had good luck with this producing consistent results. You might try getting your container divs into position using the normal flow instead of absolute positioning. Final consideration: Use IE Conditional Comments to write CSS styles specifically for IE. I hope this helps! |
![]() |
| Viewing: ASP Free Forums > Web Design > Web Layout > Master pages and DIV width problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|