1

If font-size is not set by developer, the default value is medium

So let's look at this simple code:

<head>  
    <style type="text/css">

        span .medium{
            font-size: medium;
        }
        span .larger{
            font-size: larger;
        }
    </style>
</head>
<body>
    <span class="larger">Hello World!!!</span>
    <span class="medium">Hello World!!!</span>
</body>

And what is the result? Two strings look exactly the same.

Why?

Value for font-size is not specified explicity for element body, so default value medium should be used. Then we have two spans. font-size for the first one should be larger that body font-size. font-size for the second one is absolute, and the same like for body element. So the fist text should be larger than the second one. But it is not. Could anyone explain that to me?

Thanks in advance.

4

1 回答 1

7

空间很重要。span .medium!= span.medium

span.medium{
  font-size: medium;
}
span.larger{
  font-size: larger;
}

span .medium是一个后代选择器,这意味着它正在搜索类medium a内的元素span表示与span.medium的跨度。medium

于 2013-04-30T15:14:53.880 回答