虽然段落对齐text-align:justify
,但最后一行可以有不同的长度,具体取决于内容。
我可以将相对位置放在这个位置吗?
答案 0 :(得分:2)
编辑:正如Jukka指出的那样,第一次尝试在Firefox中不起作用,所以这是一个似乎更好的编辑示例:http://codepen.io/pageaffairs/pen/Glkng
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
p {width: 50%; padding-bottom: 2em; line-height: 1.3em;}
i {position: relative;}
b {position: absolute; right: 0; bottom: -1.4em; white-space: nowrap;}
</style>
</head>
<body>
<p><span>Vegetation is the basic instrument the creator uses to set all of nature in motion.<i><b>Antoine Lavoisier</b></i></span></p>
</body>
</html>
首次尝试(在Jukka指出的Firefox中有问题):
也许是这样的? http://codepen.io/pageaffairs/pen/qKfsD
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
p {width: 340px; padding-bottom: 2em; line-height: 1.3em;}
span {position: relative;}
b {position: absolute; bottom: -1.4em; right: 0; display: inline-block; white-space: nowrap;}
</style>
</head>
<body>
<p><span>Vegetation is the basic instrument the creator uses to set all of nature in motion. <b>Antoine Lavoisier</b></span></p>
</body>
</html>