我只是想知道当这是一个内联元素时,在 span 元素上指定一个高度是否真的有意义。无论我在跨度选择器的高度上设置什么值,外观都不会改变。
这是完整的标记和 css
<!DOCTYPE html>
<html>
<head>
<meta charset = "utf-8">
<title>Relative Positioning</title>
<style type = "text/css">
p
{
font-size: 1.3em;
font-family: verdana, arial, sans-serif;
}
span
{
color: red;
font-size: .6em;
height: .6em;
}
.super
{
position: relative;
top: -1ex;
}
.sub
{
position: relative;
bottom: -1ex;
}
.shiftleft
{
position: relative;
left: -1ex;
}
.shiftright
{
position: relative;
right: -1ex;
}
</style>
</head>
<body>
<p>The text at the end of this sentence
<span class = "super">is in superscript</span>.
</p>
<p>The text at the end of this sentence
<span class = "sub">is in subscript</span>.
</p>
<p>The text at the end of this sentence
<span class = "shiftleft">is shifted left</span>.
</p>
<p>The text at the end of this sentence
<span class = "shiftright">is shifted right</span>.
</p>
</body>
</html>
//托尼