不需要的换行字体更改

时间:2014-04-12 12:48:30

标签: css text

我希望在一行中有多个文本样式,但是当我更改样式时,行会自动断开。我创建了另一个没有此问题的页面,但我找不到区别。标题样式如下:

h1 {
font-family: 'Varela', sans-serif;
font-size: 0.9em;
font-weight: 400;
color: rgb(4,4,4);
text-decoration: none;
margin-bottom: 0px;
margin-top: 0px;
line-height:normal;
font-style: normal;
letter-spacing: 0.15em;
}
h2 {
font-family: 'Montserrat', sans-serif;
font-size: 1.9em;
font-weight: 700;
color: rgb(4,4,4);
text-decoration: none;
margin-bottom: 0px;
margin-top: 0px;
line-height:normal;
font-style: bold;
letter-spacing: 0.1em;
}
h3 {
font-family: 'Open Sans', sans-serif;
font-size: 0.8em;
font-style: normal;
font-weight: 300;
line-height: 1.6em;
color: rgb(4,4,4);
margin-bottom: 0px;
margin-top: 0px;
}
h4 {
font-family: 'Open Sans', sans-serif;
font-size: 0.8em;
font-style: normal;
font-weight: 300;
line-height: 1.6em;
color: rgb(4,4,4);
margin-bottom: 0px;
margin-top: 0px;
}
h5 {
font-family: 'Open Sans', sans-serif;
font-size: 0.8em;
font-style: normal;
font-weight: 400;
line-height: 1.6em;
color: rgb(4,4,4);
margin-bottom: 0px;
margin-top: 0px;
}

1 个答案:

答案 0 :(得分:0)

H1,H2,H3等是块元素。所以不要写像:

<h1>This is one font</h1><h2> and this is another.</h2>

像这样写:

<span class="font1">This is one font</span><span class="font2"> and this is another</span>

然后给出span1和span2类不同的font-family。