繁体   English   中英

<span>向右</span>浮动<span>,其余(文本)在左侧,内部</span>浮动 <div> <span>在即7</span>

[英]Float <span> on right and the rest(text) on left, within <div> in ie 7

我有一些文本和<span>标记,它们位于<div>

<span>float: right; 我需要文本在左侧, <span>在右侧。

在每个浏览器中,除了ie7外,它显示完美。 我该如何解决这个错误?

<!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>

在文本之前移动跨度,这应该有所帮助。

span作为块元素并移动它。

span{
  display: block;
  float: right;
}

是否可以将文本包含在<p>并具有该display: inline

用户以下css它将工作。 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;
    }

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM