Groups > Asp .Net > Getting started with ASP.NET > Re: Div width problem!




Re: Div width problem!

Re: Div width problem!
Thu, 3 Apr 2008 16:54:56 +0000
Hi, try using percentages instead. I.e. Div1 width: 40%, Div2 width: 60%
Post Reply
Re: Div width problem!
Thu, 3 Apr 2008 16:55:18 +0000
try using percentage values in your css definaton instead of px values , also
remember divs defaultly have a margin value

#boxleft {float:left;width:33%;}

#boxright{ float:left; width:67%; }
Post Reply
Div width problem!
Thu, 3 Apr 2008 19:38:12 +0000
Hi Peeps,

I have two divs on a form in VS2005. The two divs are side by side which works
fine and I have configured them in a CSS file using float: left. My problem is
this, in vs2005 if I set width of my right side div to the max and run in IE it
has a gap on the right and side. If in VS2005 design I extend the width of the
second div it goes under the first making them not side by side. For some reason
in VS2005 it will only allow my two divs together to have a width of 956 yet my
res is 1024.

 Any ideas please because I need my webpage to fill the full screen of 1024px.

 Thanks for any help,

Jiggy!
Post Reply
Re: Div width problem!
Thu, 3 Apr 2008 21:13:13 +0000
Hey Hi,

i was just wondering maybe instead of using float for both divs, try absolute
positioning in one of the div....here i used it in the left div. In the second
one, use margins to move it side to side. If you're trying to get the divs
closer together then just change the margins of the boxes( i highlighted them).
Hope this helps............here is a sample code.....

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="
Default5.aspx.cs"Inherits="Default5"
%><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.
dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

<styletype="text/css">

#left {

position: absolute;

margin: 000250px;

padding: 0;

width: 100%;height: 300px;

}

#right

{

margin: 000125px;

padding: 0;

width: 100%;height: 300px;

}</style>

</head>

<body>

<formid="form1"runat="server">

<divid="left"><asp:ImageID="Image1"runat="serv
er"ImageUrl="~/hitman.jpg"/>

</div>

<divid="right"><asp:ImageID="Image2"runat="ser
ver"ImageUrl="~/godofwar2.jpg"/>

</div></form>

</body></html>

----------------------- the output...........



as you see if you change the marign value then you move the div's however close
or apart you want to......

Thanks
Post Reply
Re: Div width problem!
Thu, 3 Apr 2008 22:41:29 +0000
Hi All,

Thanks for all the advice. Even if I use % it still does not go all the way in
design so I cant put all controls to the end etc.

Jiggy
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact