473,486 Members | 2,401 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Textboxes are rendered wider than other input controls

--- This is my simple default.aspx:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"
CssClass="input"></asp:TextBox>
<br />
<asp:DropDownList ID="DropDownList1" runat="server"
CssClass="input" >
</asp:DropDownList></div>
</form>
</body>
</html>
-- and my simple default.css
..input
{
width: 150px;
}

-----------------

When i run the code what i get is pretty interesting: the textbox is
wider than dropdownlistbox (or any other input box - be listbox or
anything). The problem is present in Firefox 1.5.0.4. as is in Explorer
6.0.2900.

If i remove tag <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> the page
gets normally rendered. Any idea why this is happening?

Thanks in advance!

Jun 21 '06 #1
3 1468
Try to reduce the textBox width or use the width from the intellisense
Patrick

<fu**************@gmail.com> wrote in message
news:11*********************@y41g2000cwy.googlegro ups.com...
--- This is my simple default.aspx:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"
CssClass="input"></asp:TextBox>
<br />
<asp:DropDownList ID="DropDownList1" runat="server"
CssClass="input" >
</asp:DropDownList></div>
</form>
</body>
</html>
-- and my simple default.css
.input
{
width: 150px;
}

-----------------

When i run the code what i get is pretty interesting: the textbox is
wider than dropdownlistbox (or any other input box - be listbox or
anything). The problem is present in Firefox 1.5.0.4. as is in Explorer
6.0.2900.

If i remove tag <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> the page
gets normally rendered. Any idea why this is happening?

Thanks in advance!

Jun 21 '06 #2
This is not good solution because it does get rendered correctly on
Opera!!

Patrick.O.Ige wrote:
Try to reduce the textBox width or use the width from the intellisense
Patrick

<fu**************@gmail.com> wrote in message
news:11*********************@y41g2000cwy.googlegro ups.com...
--- This is my simple default.aspx:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"
CssClass="input"></asp:TextBox>
<br />
<asp:DropDownList ID="DropDownList1" runat="server"
CssClass="input" >
</asp:DropDownList></div>
</form>
</body>
</html>
-- and my simple default.css
.input
{
width: 150px;
}

-----------------

When i run the code what i get is pretty interesting: the textbox is
wider than dropdownlistbox (or any other input box - be listbox or
anything). The problem is present in Firefox 1.5.0.4. as is in Explorer
6.0.2900.

If i remove tag <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> the page
gets normally rendered. Any idea why this is happening?

Thanks in advance!


Jun 21 '06 #3
In article <11*********************@y41g2000cwy.googlegroups. com>,
fu**************@gmail.com writes
When i run the code what i get is pretty interesting: the textbox is
wider than dropdownlistbox (or any other input box - be listbox or
anything). The problem is present in Firefox 1.5.0.4. as is in Explorer
6.0.2900.
And who says the width of a text box has to be the same as any other
input element? If you don't specify a width, the browser uses its
default value. That is up to the browser manufacturer to decide. It
seems that both FF and MS decided to have wide text boxes by default.

If you think about it, this is quite logical. It is more likely that you
will enter long text into a text box than you would have long entries in
a list box.

Either way, the answer is simple, just specify the width.
If i remove tag <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> the page
gets normally rendered. Any idea why this is happening?


IE uses the doctype to decide which rendering mode to use. If you remove
the doctype (or actually if you remove the URL), IE switches to quirks
mode, which renders differently from standards mode. Both are full of
bugs, but standards mode is a little closer to the W3C recommendations.

HTH

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 27 '06 #4

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

Similar topics

7
4058
by: Drew | last post by:
I have a db table like the following, UID, int auto-increment RegNo Person Relation YearsKnown Now here is some sample data from this table,
4
1579
by: Jason M | last post by:
Hi, Im very new to c#, so forgive me if this is a really stupid question. Im trying to create a form for entering purchase requests. For each line item I have a quantity, a description unit cost...
4
1302
by: Timo | last post by:
Over the weekend, I am installing a website on a laptop so our sales staff can give a demonstration on Monday at a potential client site. Things are not working as expected. I'm hoping what's wrong...
1
1291
by: genc_ymeri | last post by:
Hello over there, I would like to generate the textboxes on the fly depending on the number of coulmns in a returning dataset. I tried something like this : TextBox temp = new TextBox();...
9
2517
by: Cas | last post by:
Hi, I create two textboxes and two labels. My problem is that: i want to get them under each other instead of beside each other. My second problem is that i want to have more spaces between the...
8
1571
by: clintonG | last post by:
I have to get to this later tonight or tommorrow...and wonder... There's two TextBoxes in a Wizard Step posing an either-or situtation. Only one or the other TextBox may pass data. The...
0
1115
by: begin22 | last post by:
Hey, I am using the MultiView control to create a Wizard style web app. At some point in the Wizard I need the user to input 2 values which correspond to rows and columns. On the next step in...
2
5003
by: englishman69 | last post by:
Hello, I have been banging my head against this one for a while... Searches online have revealed many different proposals for correcting my issue but none that I can follow! My basic situation...
3
1535
by: jeroen.bolle | last post by:
I'm designing a form where the user can decide how many options for a poll he wants to add. There's a "+" button to dynamically add textboxes with javascript, without a postback. How do I access...
0
7105
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6846
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...
0
7341
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...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4870
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...
0
4564
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...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1381
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 ...

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.