Heading elements are block level elements by default. Try adding display:inline
#four h5 {
font-size: 20px;
color: #ffffff;
display: inline;
}
inline-block
works as well.
fiddle: http://jsfiddle.net/5SEre/
Вопрос
I'm trying to make some input boxes with text infront of it, but each time i style the text in CSS, the styling forces my input box "to a new line". In the image the first 2 text parts is unstyled, and the next 4 is. I want my styled texts not to create a new line.
Image: http://puu.sh/8kPKl.png
The html part:
<h0>Fulde navn:</h5> <input type="text" name="name"><br>
<h0>E-mail:</h5> <input type="text" name="email"><br>
<h5>Telefon nr:</h5> <input type="text" name="tlf"><br>
<h5>Antal personer:</h5> <input type="text" name="pers"><br>
<h5>Flytype:</h5> <input type="text" name="type"><br>
<h5>Betalingsform:</h5> <input type="text" name="betal"><br>
And the CSS part:
#four h5 {
font-size: 20px;
color: #ffffff;
}
Решение
Heading elements are block level elements by default. Try adding display:inline
#four h5 {
font-size: 20px;
color: #ffffff;
display: inline;
}
inline-block
works as well.
fiddle: http://jsfiddle.net/5SEre/
Другие советы
Three things here:
<h0>
'sMake them <h5>
's
<h5>
's is a margin:#four h5{
margin: 0;
}
As pointed out by @DrydenLong in his answer, headings are block elements, and so they automatically render on their own line. You can fix this by setting them to be inline or inline-block elements:
#four h5{
display: inline;
//or
display: inline-block;
}