简体   繁体   English

带有文本的IE9元素+右浮动元素

[英]IE9 element with text + floated right element

I have an issue with an link-element that has a right-floated icon next to it. 我在链接元素旁边有一个右浮图标的问题。 In FF/Chrome everything looks good, but in IE9 the text is at the bottom of the container, not vertically aligned. 在FF / Chrome中,一切看起来都不错,但是在IE9中,文本位于容器的底部,没有垂直对齐。

<a href="#" role="button" data-toggle="modal" class="login">
   Login <span class="icon-login"></span>
</a>

.login {
   line-height: 40px;
   height: 40px;
   margin-top: 0;
   position: absolute;
   top: 0;
   right: 0;
   float: right;
}

.icon-login {
   display: inline-block;
   line-height: 40px;
   height: 40px;
   width: 40px;
   float: right;
   padding: 0;
   margin: 0 0 0 20px;
}

How it's supposed to look (the green is the beginning of the icon) 外观如何(绿色是图标的开头) 在此处输入图片说明

IE9 IE9 在此处输入图片说明

Any ideas? 有任何想法吗?

Looks like a float issue. 看起来像个float问题。

Try wrapping the Login text inside a div and float that to the left . 尝试将Login文本包装在div并将其floatleft

I think you can use someling like below. 我认为您可以像下面那样使用水果。

<a href="#" role="button" data-toggle="modal" class="login">
   Login 
</a>

.login {
   line-height: 40px;
   height: 40px;
   margin-top: 0;
   position: absolute;
   top: 0;
   right: 0;
   float: right;
   background: url(icon-login.png) right center;
   padding-right:40px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 右浮动元素下降 - Right floated element dropping (IE9)删除浮动或绝对定位的元素将导致同级元素的滚动条滚动回到顶部 - (IE9)Remove floated or absolute positioned element will cause sibling element's scrollbar scroll back to top 为什么浮动 <input> 浮动元素中的控件在IE7中向右滑动太远,但在Firefox中没有? - Why does a floated <input> control in a floated element slide over too far to the right in IE7, but not in Firefox? IE9中的元素编号朝右下方移动 - li Element Numbering in IE9 moving towards right bottom 在IE9中,h1元素导致按钮文本对齐问题 - In IE9, h1 element causes issue with button text alignment IE9没有渲染元素的边框 - IE9 is not rendering the borders of an element 两个浮动元素之间的非浮动元素-IE7 - Non-floated element between two floated ones - IE7 常规段落下方的右浮动元素,具有宽度 - Right floated element below regular paragraph with width 文本输入元素不再在IE10中提供自动完成建议(在IE9中工作) - Text input element no longer offering autocomplete suggestions in IE10 (Worked in IE9) 如何添加基于文本的单位,例如浮动到输入元素内部(或外部)的“lbs”? - How do I add text-based units like "lbs" floated to right inside of an input element (or outside of it)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM