Why is ie7 ignoring the left-margin on my first list item (only)?

蓝咒 提交于 2019-12-24 00:43:14

问题


http://blog.helpcurenow.org/test/mockups/mar2010/lp.html

In the above landing page, I have an offers box that has four donation buttons. The first three are targeted with individual id's and given a left margin of 13px.

All is well in every browser I'm viewing in except ie7. For some reason ie7 is ignoring the left-margin of 13px on the first list item, and only on that one.

The strange part is when I open ie's developer tools (not actually viewing in ie7, but using ie8 in ie7 mode) and select the element, it shows that the 13px margin is there, and not crossed out. The browser just seems to be ignoring it!

Is there some ie7 quirk I should know about here or did I miss a CSS declaration I should have added? Any ideas??

Thanks!


回答1:


Try setting the padding on the ul that houses those lis to 10px 13px, then remove the margin-left from the lis.




回答2:


Just clear the wrong borders, line-heights and box-models and you are safe.

in the top first line of your CSS, you just add:

html,body,h1,h2,h3,h4,h5,h6,p,ul,li,img {border:none;padding:0;margin:0; /* etc. like font-size:10px;line-height:10px; */}

then you can set the "wanted" values on each item afterwards: further more you can set

display:block;

on your elements then they will use the same box-model. IE6/IE7 does not understand inline-block which is default for some elements I believe.



来源:https://stackoverflow.com/questions/2372799/why-is-ie7-ignoring-the-left-margin-on-my-first-list-item-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!