I have certain controls in my website which look properly aligned in visual studio. But when i run the application on a web browser , they are all out of place. Does it have something to do with absoulute and relative positioning?
If you are using Master page and including css in master page. If the content pages(.aspx pages) are in folder then possibly the css in not aplied in child(.aspx) pages.
For this the css needs to be loaded from server side or by using resolveclienturl in master page.
The problem is that i havent used css nor have i used tables to place the textboxes. Why is absolute and relative positioning always a pain in the a**? Cant they be used as a standalone instead of using css/tables?
Anyways can you tell me how to use a css as you mentioned above (remember i havent used a table)
the textboxes where placed fine . but when i tried to place labels the textboxes moved to the right. I tried to use "left" instead of "margin-left" and it got worse... HELP?
achuthan1988
Member
53 Points
159 Posts
controls are out of alignment when debugged!
May 01, 2012 01:12 AM|LINK
I have certain controls in my website which look properly aligned in visual studio. But when i run the application on a web browser , they are all out of place. Does it have something to do with absoulute and relative positioning?
MetalAsp.Net
All-Star
112075 Points
18242 Posts
Moderator
Re: controls are out of alignment when debugged!
May 01, 2012 03:21 AM|LINK
Deepak_Talel...
Member
458 Points
87 Posts
Re: controls are out of alignment when debugged!
May 01, 2012 04:43 AM|LINK
If you are using Master page and including css in master page. If the content pages(.aspx pages) are in folder then possibly the css in not aplied in child(.aspx) pages.
For this the css needs to be loaded from server side or by using resolveclienturl in master page.
Let me know if this resolves your issue
Ph: 91-9158413830
Email: deepak_talele@hotmail.com, deepak_talele@yahoo.com
achuthan1988
Member
53 Points
159 Posts
Re: controls are out of alignment when debugged!
May 01, 2012 09:02 AM|LINK
The problem is that i havent used css nor have i used tables to place the textboxes. Why is absolute and relative positioning always a pain in the a**? Cant they be used as a standalone instead of using css/tables?
Anyways can you tell me how to use a css as you mentioned above (remember i havent used a table)
DimpleSharma
Member
86 Points
18 Posts
Re: controls are out of alignment when debugged!
May 01, 2012 10:16 AM|LINK
Either place all the controls inside Table....
or you can use CSS... here is a small demo script
<Head>
<style type="text/css">
.container{
<div>width:500px;
margin-left:auto;
margin-right:auto;
text-align:left;
}
.textbox
{
height: 10px;
width : 20px;
}
</style>
</head>
<body>
<form.......................>
<div class= "container">
---------------
-----
</div>
</div>Note : this is just a sample scirpt ..
nijhawan.sau...
All-Star
16400 Points
3173 Posts
Re: controls are out of alignment when debugged!
May 01, 2012 10:28 AM|LINK
Basic page layout using CSS:
<html> <head> <title> my website </title> <meta name="keywords" content="joe bloggs' website, site, pages,"> <meta name="author" content="joe bloggs"> <link href="stylesheet.css" rel="stylesheet" type="text/css"> </head> <body> <div id="image"> <img src="images/bla.gif" align="left" alt="layout image 1"><br /> </div> <div id="main"> <h1>Welcome to my website</h1> <p>This is my wonderful website with funky content and groovy images!</p> </div> </body> </html>#image { float: left; width: 500px; } .image { float: left; width: 500px; }Another example:
HTML:
<body> <div id="wrap"> <div id="header"> </div> <div id="content"> </div> <div id="sidebar"> </div> <div id="footer"> </div> </div> </body>#wrap { margin: 0 auto; width: 800px; } #content { float: left; width: 500px; } #sidebar { float: right; width: 280px; } #footer { clear: both; }achuthan1988
Member
53 Points
159 Posts
Re: controls are out of alignment when debugged!
May 01, 2012 11:25 AM|LINK
<style type="text/css">
.textbox
{
height:25px;
width:120px;
margin-left:432px;
}
.label
{
height: 25px;
width : 25px;
margin-left:75px;
}
the textboxes where placed fine . but when i tried to place labels the textboxes moved to the right. I tried to use "left" instead of "margin-left" and it got worse... HELP?
nijhawan.sau...
All-Star
16400 Points
3173 Posts
Re: controls are out of alignment when debugged!
May 01, 2012 12:02 PM|LINK
Can you try reducing the left margin property for your textbox:
margin-left:10px;
res.web
Member
546 Points
138 Posts
Re: controls are out of alignment when debugged!
May 01, 2012 12:07 PM|LINK
<style type="text/css">
.left_label
{
float:left;
height: 25px;
width : 25px;
}
.right_textbox
{
float:left;
height:25px;
width:120px;
}
</style>
achuthan1988
Member
53 Points
159 Posts
Re: controls are out of alignment when debugged!
May 01, 2012 12:15 PM|LINK
Now there is a twist . The thing i want is in a content page of a larger application.