?
Solved

align textbox in div

Posted on 2009-02-19
4
Medium Priority
?
661 Views
Last Modified: 2012-05-06
hi there; i have a simpe <div> 25px high and 600px wide.

i want to put a textbox in there that is the exact height (25px) and 200px wide.

<div style="width:600px; height:25px; background-color:Blue;">
    <asp:TextBox ID="txtText" runat="server" style="height:25px; width:200px; font-size:100%; padding:0px; margin:0px; border:0px;" />
    </div>

in firefox, this works perfectly.  in ie it leaves a 1 px space above it (see image).

suggestions?

thanks all.
textbox.jpg
0
Comment
Question by:vbnewbie01
  • 2
4 Comments
 
LVL 12

Expert Comment

by:CB_Thirumalai
ID: 23688035
Can you try this? Works both in IE and Firefox
<div style="width:600px; height:25px; background-color:Blue;">
    <asp:TextBox ID="txtText" runat="server" style="height:25px; width:200px; font-size:100%; position:relative;top:-2px; margin:0px; border:0px;" />
</div>

Open in new window

0
 
LVL 15

Accepted Solution

by:
aibusinesssolutions earned 300 total points
ID: 23688362
Or just use position:absolute; in your textbox, works in both IE and Firefox.

style="height:25px; width:200px; font-size:100%; padding:0px; margin:0px; border:0px; position:absolute;"
0
 
LVL 1

Author Comment

by:vbnewbie01
ID: 23694372
leaning toward aibusinesssolutions and thanks to you both but can either of you explain why the space was there in the first place?
0
 
LVL 15

Expert Comment

by:aibusinesssolutions
ID: 23694742
One of the biggest quirks between IE and Firefox is how they display their textboxes. Unfortunately, there is not much you can do other than customizing the styles to get them close.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question