Is there a way to stop a <br>
tag breaking using only CSS?
I tried br{display:none}
whick works, but it also gets rid of the space between the two words, which I need to keep.
This is only for webkit (iPhone) so any CSS3 extravaganza is just fine.
I can't edit the content from the CMS, so simply removing the tag unfortunately isn't an option for me.
thanks!
Solution: It is not possible to remove just <p> tags without removing content inside.
Use white-space: nowrap; or give that link more space by setting li 's width to greater values. I prevented line break in li items using display: inline; . Maybe this will also help others with similar problems. Its important to be careful with display: inline as it can have side effects.
There are many ways to break the line without using <br> tag. The used properties are listed below: white-space: pre; It is used to make elements acts like <pre> tag. display: block; It sets the display property of elements to block.
A line-break can be added in HTML, using only CSS, by employing the pseudo-class ::after or ::before . In the stylesheet, we use these pseudo-classes, with the HTML class or id, before or after the place where we want to insert a line-break.
Following on the answers here, this prevents the <br>
tag breaking in both Chrome and IE:
br { content: " "; display: none; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With