开发者

HTML/CSS: Floating element in H2 element

开发者 https://www.devze.com 2022-12-11 03:31 出处:网络
This is the HTML: <h2> Log in <a onclick=\"doSomething()\" href=\"#\" class=\"float-right\">&nbsp;</a>

This is the HTML:

<h2>
  Log in
  <a onclick="doSomething()" href="#" class="float-right">&nbsp;</a>
</h2>

This is the CSS:

.float-right {
    float: right;
    background: url(img.png);
    width: 10px;
    height: 10px;
    text-decoration: non开发者_开发知识库e;
}

So this should make the .float-right element float to the right of the text in the header, but in IE7 it doesn't! I don't care about IE6, I just have to get this working in IE7 and newer.


Have you tried to move the code around?

<h2>
  <a onclick="doSomething()" href="#" class="float-right">&nbsp;</a>
  Log in
</h2>


try adding display:block; to the css

0

精彩评论

暂无评论...
验证码 换一张
取 消