2 回答
TA贡献1773条经验 获得超3个赞
一种方法是使用float
.small-text{
float: right;
font-weight: italic;
font-size:.8rem;
color:grey
}
<br/>
<div>
<span class="small-text"> March 07, 5:45pm </span>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
</p>
<div>
TA贡献1111条经验 获得超0个赞
使用CSS
<!DOCTYPE html>
<html>
<body>
<br/>
<div>
<span style="float: right;font-weight: italic;font-size:.8rem;color:grey"> March 07, 5:45pm </span>
<p style="text-align: right;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
</p>
<div>
</body>
</html>
使用JavaScript
<!DOCTYPE html>
<html>
<body>
<p id="p1">Lorem ipsum dolor sit amet consectetur adipisicing elit.<br>Quaerat quas tenetur aliquam ipsum vitae, excepturi, accusamus <br> vel nostrum obcaecati praesentium neque id inventore laborum <br>distinctio quam dolor ullam consectetur nesciunt?</p>
</body>
<script>
var textnode = document.createTextNode(" March 07,5:45pm"); // Create a text node
var p = document.getElementById("p1"); // Get the <ul> element to insert a new node
p.insertBefore(textnode, p.childNodes[1]); // Insert <li> before the first child of <ul>
</script>
</html>
- 2 回答
- 0 关注
- 79 浏览
添加回答
举报