简体   繁体   English

在div中重新排列span元素

[英]Re-arranging span elements in a div

I'm trying to get an asterix "*" to appear directly above the "pp", however if I try to insert this in a span adjacent to the span containing the "pp" or directly after the price, it does not sit above as desired.. 我正在尝试使星号“ *”直接显示在“ pp”上方,但是,如果我尝试将其插入到包含“ pp”的跨度旁边的跨度中,或者直接插入价格之后,它就不会位于上方如预期的..

Can somebody please help? 有人可以帮忙吗? My html is below 我的HTML在下面

 <div class="fist-div"> <span> <span data-bind="text: '£' + price">£731*</span> <small>pp</small> </span> </div> 

You can use sup tag to do this. 您可以使用sup标签执行此操作。 Try this. 尝试这个。

CSS & HTML CSS和HTML

 sup{color:red} 
  <div class="fist-div"> <span> <span data-bind="text: '£' + price">£731</span> <small>pp<sup>*</sup></small> </span> </div> 

You can rearrange it wherever you want * to appear. 您可以在希望出现*的任何地方重新排列它。 Hope this help. 希望对您有所帮助。

If you want * directly above pp, you need to adjust the position. 如果要*直接位于pp上方,则需要调整位置。

 .first-div small { position: relative; left: -10px; top: 2px; } 
 <div class="first-div"> <span> <span data-bind="text: '£' + price">£731*</span> <small>pp</small> </span> </div> 

You can do like this.. 你可以这样

 sup { color: green; position: relative; left: 10px; } 
 <div class="fist-div"> <span> <span data-bind="text: '£' + price">£731<sup>*</sup></span> <small>pp</small> </span> </div> 

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

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