Re: ASP.NET newbie - how to align panels horizontally

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



JM,

indeed display: inline-block works in IE6 because of 2 bugs in IE6. IE7 has only one "bug" there is an undocumented feature called hasLayout which is triggered by switching on "display:inline" . this markup works in both browsers (Fx and IE7. I am ignoring IE6, but there is an additional setting for the hacks line) - the * in front of the display is important as all browsers except for IE7 ignore it. zoom is used to toggle hasLayout, display: inline switches IE7 to inline-block mode.



div.hbox
{
border: dotted 1px Gray; /* layout test */
-moz-border-radius: 3px; /* layout test */
text-align: left;
Width: 100%;
margin-bottom: 5px;
}
div.hpanel
{
border: dotted 1px #CCC; /* layout test */
-moz-border-radius: 2px; /* layout test */
display: inline-block;
padding-left:5px;
margin-right: 5px;
vertical-align:top;
/* ie7 quirk for toggling hasLayout and inline-block! */
zoom:1.0; *display: inline;
}

<div class="hbox">
<div class="hpanel">
Area1
<div>
<div class="hpanel">
Area2
<div>
<div class="hpanel">
Area3
<div>
</div>

the advantage of this approach that this is almost fluid layout with nicely horizontally arranged form panels - the hbox containers always fill the whole width of their parent, which should allow for nice multiple nesting (not tested). Border should be set to 0 for the finished product, I am displaying as dashed to see how my browsers render the panels.

The only thing this is missing is a nice "flex" attribute to grow selected hpanels and make the layout even more fluid. That's probably not possible with CSS 2, but hopfully CSS 3 will introduce something like this.

If anybody here has ever tried XUL, they have a brilliant and very simple layout language which achieves just about any form layout with hbox, vbox and flex attributes. ASP.NET could be great if it had CSS compliant hbox and vbox container controls.

cheers
Axel

JM wrote:
If I insert 3 divs that do not containt panels they show up as expected:

<div class="hpanel"> pre hpanel </div>
<div class="hpanel"> another one </div>
<div class="hpanel"> another one </div>

the panels however always show on top of each other, no matter what style rules I set. Any idea how I can make 2 panels beside each other using the panel - Style builder?

I just tried the above snippet with your div.hpanel and it worked fine
in both FF2 and IE6 with the xhtml1-transitional DTD.

Do a Google search for IE6 vs IE7 div issues and I'll bet you find
the keys to the answer.

John


.



Relevant Pages

  • Re: Filling remainder of height
    ... Using tables for layout, while frowned upon by some, isn't ... regardless of whether the bulk of yours use old browsers or not. ... can be added to a DIV tag that can't be added to a table, ...
    (alt.html)
  • Re: IE compatible way of forcing footer to bottom of page?
    ... is over-ruled later in the style sheet will have all elements following ... things that will not bugger up the other heathen browsers. ... That is, in IE7 and below, the TopOfPageIcons div is ... non-IE browsers, and in IE8, the div is positioning itself relative to ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: Layout basics
    ... I can certainly see why you would call the positioning issue an "absolute nightmare." ... A web application is an application in which the vast majority of the programming is on a server machine, but the user interface is presented via a "thin-client" HTML browser user interface. ... HTML started out as an invention of the Mosaic group, who created the first web browsers, and a language for formatting display in those browsers. ... HTML started off rather simply, with not much thought in the way of fancy layout, and the use of an ever-expanding list of inline attributes to handle layout properties. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Javascript Best Practices Document v1.0
    ... across browsers, it's much easier to accomplish nice layouts that equivalent CSS layout, it degrades more consistently than CSS, and it's easier. ... A table-based layout renders more consistently across browsers than a CSS-based layout, ... how consistent and accurately consistent the layout should be for browsers like, say, IE4, IE5.x, etc. ...
    (comp.lang.javascript)
  • Re: Javascript Best Practices Document v1.0
    ... absolutely want to create roughly the same page layout in NS4, IE4, Opera 8.50 and Safari 2.01, then a table-based design for your page will meet such requirements. ... Browsers and browser versions don't just consult *_you_* before rendering a page, ... Furthermore if consistent layout is a goal in itself for a web developer. ... http://www.csszengarden.com/ Go ahead and send an email to the creators of that site stating that CSS is "not so good for layout" and you'll get replies for sure. ...
    (comp.lang.javascript)