I have some text and <span>
tag, which are inside a <div>
.
<span>
is float: right;
I need the text to be on the left side and <span>
on right side.
In every browser it displays perfectly except ie7
. How can I fix this bug?
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title> Testing page</title>
</head>
<body>
<div style="border:2px solid #000; display:inline;">
welcome<span style="float:right"> demo</span>
</div>
</body>
</html>
在文本之前移动跨度,这应该有所帮助。
Make span as block element and move it.
Ie
span{
display: block;
float: right;
}
是否可以将文本包含在<p>
并具有该display: inline
?
User the following css it will work. DEMO LINK
*{
padding:0;
margin:0;
}
body {
font:normal 12px/18px Arial, Helvetica, sans-serif;
color:#000;
padding:20px;
}
.container {
border:2px solid #000;
padding:20px;
overflow:hidden;
height:100%;
}
.container span {
display:inline-block;
*float:left;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.