Archives

Archives / 2005 / February
  • Bug or Not?

    Hmmm, I forget how the box model is supposed to do things in CSS, but this seems a little off to me.  What I had was a div tag with a width of 500px.  Within that I have a nested div with a margin of 25px.  I WAS trying to avoid having to do a box model hack to make sure things look OK in IE 5.x. 

    So everything is hunky dory until I take this layout and put it into a masterpage in VS2005.  I drop the ContentPlaceHolder and suddenly my 500px div is 550px large.  It seems VS2005 is trying to figure out how wide to make the ContentPlaceHolder "container," and forgetting about the margins (or padding (or borders)).  This also happens when you have a panel or anything else set to a width of 100%.  So it is just pushing it wider.  And since I'm using floats to do the layout, in VS2005 it is pushing my sidebar down because it is too wide to fit into the container.  IE 6.0 and Firefox seem to be getting this "right," but honestly I'm not too sure when Firefox is immulating bugs in IE or when IE is in compliance mode anymore.

    I'm leaning towards bug.  If anyone is curious, here's the fancy code that is screwing stuff up:

            <div style="width: 500px">
                <div style="padding: 25px; background-color: Orange; border: solid 1px black">
                    <asp:Panel runat="server" ID="test" style="width:100%">
                        jyeretjetjetj</asp:Panel>
                </div>
            </div>
            <div style="width: 500px; border: solid 1px black">
                another 500px div
            </div>


    Take out the panel and just put normal text (or even just a div with width=100%) and it displays fine.

    So, bug or not?