CSS技巧.将名称放在下一行或同一行上
如果第一行很短,则名称将放在下一行.如果第一行很长,则名称放在同一行.
/* heart of the matter */
.container:first-line {
word-spacing: 240px; /* the width of the container,or more */
}
.content {
word-spacing: normal;
}
.insert {
margin-right: -11px; /* defined by the normal inter-word space */
}
/* nice look */
.container {
border: 5px solid black;
float: left;
font-family: Helvetica;
font-size: 20px;
font-weight: bold;
margin: 0 15px 30px 0;
min-height: 60px;
padding: 8px 10px;
width: 240px;
}
.name {
color: red;
}
/* little explanation */
.colored-background .content { background-color: lightblue; }
.colored-background .insert { background-color: orange; }
Something
Steve
Something Something Else
Steve
Something
Steve
Something Something Else
Steve