use*_*273 1 html css right-align
我想在span元素的右侧对齐图像.
我在td元素中工作得很好,但现在我已经将它移动到了一个范围内.将不胜感激任何建议.
<div style="width:400px;">
<span style="display:inline-block;width:50%;" onclick="location.href='http://www.google.com'">Go to Google</span><span style="display:inline-block;width:50%;float:right;weight:bold;" onclick="location.href='http://www.yahoo.com';><img src="test.gif" width=40 height=40 border=0>Go to Yahoo</span>
</div>
Run Code Online (Sandbox Code Playgroud)
这个怎么样?
<div>
<span onclick="location.href='http://www.google.com';">Go to Google
<img src="https://www.google.com/images/srpr/logo11w.png" width="40" height="40" border="0" />
</span>
<span onclick="location.href='http://www.yahoo.com';">Go to Yahoo
<img src="https://www.google.com/images/srpr/logo11w.png" width="40" height="40" border="0" />
</span>
</div>
Run Code Online (Sandbox Code Playgroud)
以下是CSS:
div {
width: 400px;
}
span {
display: inline-block;
width: 50%;
float: left;
}
img {
float: right;
}
Run Code Online (Sandbox Code Playgroud)
http://jsfiddle.net/grim/sVdE3/2/
请注意,您的标记中存在一些错误,例如您未关闭的引号(").