line break css code example

Example 1: css prevent line break

white-space: nowrap;

Example 2: css line break width

span { 
    display:block;
    width:150px;
    word-wrap:break-word;
}

Example 3: enter in css

white-space: pre-line

Example 4: line break inside content css

p:after {
	display: block;
	white-space: pre-line;
	content: "Me too! \A Me three!";
}

Example 5: new line ::after class

#headerAgentInfoDetailsPhone:after {
  content:"Office: XXXXX \A Mobile: YYYYY ";
  white-space: pre; /* or pre-wrap */
}

Tags:

Css Example