css property for breaking sentences
I've a text "Europcar The Quickest Way From Runway To Road"
.I want to disp开发者_如何学运维lay this like
Europcar
The Quickest Way From Runway To Road
how to get in this format using CSS without changing the HTML code.
You can’t really in a nice way.
The only way would be to add (e.g. with :after
) another block element, position it to where you don’t want the text and make the text float around any top-elements.
With nothing to style there CSS is not the right thing. CSS is for styling, the missing newline is missing some markup however.
What you are looking for is a pseudoclass that doesn't exist. There is :first-letter and :first-line, but no :first-word.
Here is the topic you can check CSS to increase size of first word
If the original string has now html tags like a span or something else, it's not possible with pure CSS. CSS offers only the pseudo selectors :first-line
and :first-letter
but not :first-word
what you need. In other words, you can't select the first word of a text with CSS to insert a line-break :after
it.
You can do it with Javascript but not width pure CSS. http://www.dynamicsitesolutions.com/javascript/first-word-selector/
精彩评论