Html 在 <div> 标签中定位 <span> 标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7887387/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:14:51 来源:igfitidea点击:
positioning <span> tag in side <div> tag
提问by Priyanka
i'm designing with div and span tag & i have created table by using these two tages. I want to set the position of the particular span inside the div . how to do this?
我正在使用 div 和 span 标签进行设计,并且我使用这两个标签创建了表格。我想在 div 中设置特定跨度的位置。这该怎么做?
below is my design
下面是我的设计
<html>
<head></head>
<body>
<div style="margin-left:10px;margin-right:10px;">
<div style="height:30px;">
<span class="name">A.B. Enterprises</span>
<span>(42100001)</span>
<span>OS : Cr.</span>
<span style="float:right; left:0px; top:0px;position:relative;">
<span><img src='C:/Documents and Settings/priyanka/Desktop/BlueColor.gif' alt="" /></span>
<span ><img src='C:/Documents and Settings/priyanka/Desktop/BlueColor.gif' alt="" /></span>
<span><img src='C:/Documents and Settings/priyanka/Desktop/BlueColor.gif' alt="" /></span>
<span><img src='C:/Documents and Settings/priyanka/Desktop/BlueColor.gif' alt="" /></span>
</span>
</div>
<div>
<span>Supriya Dye Chem</span>
<span>Turn Over : Cr.</span>
</div>
<div>
<span>Indrabhan Pandey</span>
<span>(Mumbai1</span><span>,Mumbai1)</span>
</div>
<div><hr /></div>
</div>
</body>
</html>
thanks
谢谢
回答by mohana rao
<div style="position:relative;">
<span style="position:absolute: top:0px; left:0px;"></span>
</div>
回答by juankysmith
<div class="your_div">
<span style="float:left; left:0px; top:2px;"></span>
</div>
You can set the position playing with 'left' and 'top' values
您可以使用 'left' 和 'top' 值设置播放位置