473,568 Members | 2,939 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem rendering a 100% width textbox on IE using XHTML 1.0 stand

Hello all,

I've created the following ASP.NET code sample which, when rendered,
displays a 100% textbox within a single cell table. The problem is that
Internet Explorer (6 or 7) truncates the right-hand edge of the textbox. The
textbox renders correctly on Firefox and Netscape.

<%@ Page Language="VB" AutoEventWireup ="false" CodeFile="test. aspx.vb"
Inherits="Conte nt_test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="frmMyForm" runat="server">
<table style="width: 100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<asp:TextBox ID="txtMyText" runat="server"
Width="100%"></asp:TextBox>
</td>
</tr>
</table>
</form>
</body>
</html>

However, if the following DOCTYPE tag is used instead of the XHTML one
above...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

.... then IE renders the textbox correctly also.

Can anyone tell me why this happens? Why is the textbox rendered
differently between the two standards and why does only IE have the problem?

XHTML 1.0 appears to be the default DOCTYPE tag added to all .aspx pages (in
VS 2005/.NET 2.0), so I assume this is the latest standard we should be using.

Is there anything that can be done to make XHTML 1.0 work with IE so that
the textbox will display how I expect it to?

Any help appreciated.

Thanks,
Wayne.
May 2 '07 #1
1 2800
please read about w3c standards especially widths. setting xhtml set IE
in strict mode where it tries to follow the standards.

the main point to understand is when you set the width of an html
element, you are setting the width of the content. the border and margin
are outside the content.

in your case you are setting a textbox width to its parent width, but
the margin and border cause it to be offset. then the right hand side
overflows the parent. in strict mode IE truncates (overflow:hidde n), in
non-strict it resizes the parent.

-- bruce (sqlwork.com)

wclarke101 wrote:
Hello all,

I've created the following ASP.NET code sample which, when rendered,
displays a 100% textbox within a single cell table. The problem is that
Internet Explorer (6 or 7) truncates the right-hand edge of the textbox. The
textbox renders correctly on Firefox and Netscape.

<%@ Page Language="VB" AutoEventWireup ="false" CodeFile="test. aspx.vb"
Inherits="Conte nt_test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="frmMyForm" runat="server">
<table style="width: 100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<asp:TextBox ID="txtMyText" runat="server"
Width="100%"></asp:TextBox>
</td>
</tr>
</table>
</form>
</body>
</html>

However, if the following DOCTYPE tag is used instead of the XHTML one
above...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

... then IE renders the textbox correctly also.

Can anyone tell me why this happens? Why is the textbox rendered
differently between the two standards and why does only IE have the problem?

XHTML 1.0 appears to be the default DOCTYPE tag added to all .aspx pages (in
VS 2005/.NET 2.0), so I assume this is the latest standard we should be using.

Is there anything that can be done to make XHTML 1.0 work with IE so that
the textbox will display how I expect it to?

Any help appreciated.

Thanks,
Wayne.
May 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2690
by: B McDonald | last post by:
Hi. I am trying to straighten out some DIV issues in the rendering of my no-tables CSS website. Right now the biggest issue is trying to render 2 columns several DIVs deep in the box model for my index page. If you go to http://galtsvalley.com/newindex.html - you will see the problem area. I've highlighted the relevant blocks with nice, harsh...
4
2893
by: Rodrigo DeJuana | last post by:
Howdy, I'm new to this .net stuff and really have little to no training. Im trying to create a new page for a web form, so i have been pretty much jsut coping code. I having some issue with some textboxes not updating when i a hit save. for example I have this code in my aspx.cs file: declared:
5
1319
by: Luis Fajardo | last post by:
I'm expiriencing a basic HTML appearance problem with ASP.NET. Following a couple of sample tags to ilustrate my problem: <asp:TextBox id="txtWidthIssue" runat="server" Width="100"></asp:TextBox> <asp:DropDownList id="ddlWidthIssue" runat="server" Width="100"></asp:DropDownList> Browser like Firefox and I'll imagine many others are not...
7
2284
by: Lee | last post by:
Hello all, I have an aspx page with a Div that holds a few controls such as textbox and combo box. I use this same setup on several other pages with no problem. For one page in particular, the borders around the div are not rendered correctly and I am having a pickel of a time figuring out why. Like so:
0
2481
by: sdash | last post by:
I'm working on a simple formview screen that should update a SQL Server 2000 record. I'm sure there must be something simple wrong, but when I press update, the screen refreshes and the changes are not committed to the table. Can anyone give me some suggestions here? Thanks in advance (code below) <%@ Page Language="C#"...
1
1930
by: Shadow Lynx | last post by:
Consider this simple HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Strict kills my widths!</title> </head> <body> <table style="width:400px; table-layout:fixed;">
0
2390
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile View I want the form populated from there profile on the sql server. The code to save the profile works fine. But when the user logs back in they data...
0
3483
by: sjickells | last post by:
Hi I am having a problem using asp:TextBox's in a transparent table. I have a background image on the page and a table in the middle of the page. I have set the background colour of the table to white the used CSS to set the opacity to 90 so that you can see the background image through the table. The problem I am having is with the...
1
2165
zuquirio
by: zuquirio | last post by:
Hi! I got a strange problem in IE7 with the font rendering after I apply a fade in effect using Spry. At this page you can see a screenshot of the problem in IE7: http://mariuzzo.com/p/thescripts/ie7.JPG It work on Firefox and Opera but no in IE7 Here is another screenshot in Firefox: http://mariuzzo.com/p/thescripts/ff.JPG Did you...
0
8117
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7660
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5498
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2101
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
932
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.