473,385 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

double margin bug in ie without floats!?

I have a really strange layout bug in a web page, that only appears in IE. An INPUT element inside a DIV is getting an extra left margin, the same as the parent DIV has been given.

It is as if the old "double margin on floats" was kicking in, but there are no floats in this layout! And it only affects the INPUT, not text or a SELECT within the same DIV...
I would really need some pointers on how to attack this.

Thanks / Mike

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
  2. <html>
  3.   <head>
  4.     <title>inputmargin.html</title>
  5.   </head>
  6.   <body>
  7.     <div style="width: 35em; background-color: blue;">
  8.       <div style="width: 20em; margin-left: 10em; background-color: green;">
  9.         This input gets an extra 10em margin:<br>
  10.         <input type="text">
  11.         <br>
  12.         But this dropdown doesn't:<br>
  13.         <select></select>
  14.       </div>
  15.     </div>
  16.   </body>
  17. </html>
Sep 13 '06 #1
4 2876
drhowarddrfine
7,435 Expert 4TB
Yes, this is an IE bug (among a bazillion others). The only fix I am aware of is to enclose the inputs in a <p>. I don't recall much beyond that.
Sep 13 '06 #2
Hi - thanks for the input!
So you don't reckon there is a way to fix this in CSS only, without adding additional markup?
(Trying to do layouts with semantically clean markup is a challenge...;-)

Best regards
Mike
Sep 13 '06 #3
drhowarddrfine
7,435 Expert 4TB
Well, IE sometimes forces you to do goofy things. Inputs need to be enclosed anyway so there's nothing wrong with doing that. You'll eventually need the form element so:
<form>
<p>
<input .....>
</p>
</form>

or you could/should look into fieldsets. I don't know if you'll have the same problem though.
Sep 13 '06 #4
My complete page actually has both <form> and <fieldset> wrapping the shown markup, but unfortunately they don't improve this particular problem.
Thanks for the help!
Best regards
Mike
Sep 14 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: trialanderror | last post by:
I've been happily chugging along thinking I understood floating divs and now find that I know a lot less than I thought I did. And the more I try "fixing" things, the worse it gets. A lot of what...
8
by: Warren Post | last post by:
Here's a problem I've never seen before. On <http://snow.prohosting.com/srcopan/anti/>, should the viewport width be less than the width of the page's header, then the right margin becomes stuck...
1
by: Marek Mänd | last post by:
I have question regarding (clearing) floats and margin-top on DL and HR elements. http://www.hot.ee/idaliiga/testcases/dl/language-chosing-selector.htm Namely the IE6 doesnt calculate the...
10
by: tbcarver | last post by:
I have a table that I am trying to add a bottom margin to in IE. I have found that if the table is inside more than 1 div then the shape of the containing div collapses. Please look at this...
26
by: meltedown | last post by:
I have 2 left floating divs on a page. Sometime the left side is larger, sometimes the right side is larger. I want the page to have a margin at the bottom of whichever div is the largest. If I...
6
by: Hacking Bear | last post by:
Hi, I still don't quite fully understand how to handle mixing border/margin pixel width with percentage width. In the example below, I want to place side-by-side two DIV boxes inside a box....
7
by: subramanian100in | last post by:
In the post with heading "Learning C - Scanf or Getch, or Getchar not working correctly after first loop" that appears in today's list in comp.lang.c, it has been mentioned in the answer to this...
6
by: John Moore | last post by:
My mysql data type is double(16,2) with '0.00' specified as default. These represent dollars and cent amounts. My question is: How do I perform simple mathematical operations on these money...
22
by: Bill Reid | last post by:
I just noticed that my "improved" version of sscanf() doesn't assign floating point numbers properly if the variable assigned to is declared as a "float" rather than a "double". (This never...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.