1

I have this code:

<h1><a href="">Windows Store<br /><span class="smallSubText">apps</span></a></h1>

and:

#windowsStoreApplications {
    float: right;
    width: 50%;

    font-size: 16pt;
    text-align: center;
    height: 182px;

    background-color: #9DCA87;
    border-top: 6px solid #AEDF66;
}


.smallSubText {
    font-size: 16pt;
}

As you can see, both the h1 and span are set to the same font-size - this is not how I want it but it's how I made it because I noticed that the font-sizes were not matching up to how they should be.

I made them both the same size to demonstrate that they are both the same size in code, but when you run the site and look at it - they're actually different sizes.

Is this due to some size weirdness with the h1 element?

4

2 回答 2

4

如果#windowsStoreApplications 是一个div,那么您需要在您的css 中声明一个#windowsStoreApplications h1{} 标记并使用font-size:16px; 设置元素的样式。那里。否则,您不会选择 h1 元素。

于 2013-08-09T20:07:33.373 回答
2

Well first, if you havn't declared a font-size for your h1's (and the rest) the browser defaults will be implemented which vary in size.

Second, you should not be using pt for your size, you should be using px, em or %.

#windowsStoreApplications h1 {
font-size:16pt; /* or preffered unit */
}
于 2013-08-09T20:08:29.463 回答