我在div中有2个段落,我需要其中一个是14px,另一个是16px。我试图把第一个放到课堂上,但它没有取得14px的价值...... 作为简历,我需要" 12 mei,2014 |运动"字体大小为14px,另一个为16px。
这是我的代码:
#kolom4 {
width: 1440px;
height: 718px;
background: #222222;
}
#kolom4 h2 {
margin-bottom: 40px;
padding-top: 29px;
}
#kolom4 p {
color: white;
font-size: 16px;
}
#kolom4 h3 {
color: #fdd400;
font-size: 20px;
}
.kolom4Date {
font-size: 14px;
color: white;
}
#section1 {
float: left;
text-align: left;
margin-left: 249px;
margin-bottom: 62px;
}
#text_img1 {
float: right;
width: 383px;
height: 220px;
margin-left: 20px;
}
#text_img1 a {
float: right;
text-decoration: none;
color: #fdd400;
font-style: oblique;
}

<div id="kolom4">
<h2>Nieuws</h2>
<div id="section1">
<img src="images/kolom4Image1.jpg" />
<div id="text_img1">
<h3>Lorum ipsum</h3>
<p class="kolom4Date">12 mei, 2014 | Sport</p><br>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.Ut enim ad minim veniam [...]</p><br>
<a href="#">Lees meer ></a>
</div>
</div>
</div><!-- end kolom4 -->
&#13;
答案 0 :(得分:3)
变化:
.kolom4Date {
为:
#kolom4 .kolom4Date {
现在问题是你使用ID进行样式化,这种方式过于具体,从长远来看你会遇到其他问题。尝试使用类而不是它会变得更容易。
答案 1 :(得分:0)
由于您定位元素的方式,您将覆盖样式font-size:16px。而不是使用
#kolom4 p{}
使用:
.kolom4p{ font-size: 16; }
然后将类kolom4p添加到段落中。
答案 2 :(得分:-1)
试试这个:
.kolom4Date {
font-size: 14px !important;
color: white;
}