{"id":269613,"date":"2018-05-09T14:43:18","date_gmt":"2018-05-09T21:43:18","guid":{"rendered":"http:\/\/css-tricks.com\/?p=269613"},"modified":"2020-04-24T14:21:49","modified_gmt":"2020-04-24T21:21:49","slug":"where-lines-break-is-complicated-heres-all-the-related-css-and-html","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/where-lines-break-is-complicated-heres-all-the-related-css-and-html\/","title":{"rendered":"Where Lines Break is Complicated. Here’s all the Related CSS and HTML."},"content":{"rendered":"\n

Say you have a really<\/em> long word within some text inside an element that isn’t wide enough to hold it. A common cause of that is a long URL finding it’s way into copy. What happens? It depends on the CSS. How that CSS is controlling the layout and what the CSS is telling the text to do.<\/p>\n\n\n\n\n\n\n\n

This is what a break-out text situation might be like:<\/p>\n\n\n\n

\"\"<\/figure>\n\n\n\n

The text hanging out of the box is a visual problem.<\/p>\n\n\n\n

One possibility is overflow: hidden;<\/code> which is a bit of a blunt force weapon that will stop the text (or anything else) from hanging out. Yet, it renders the text a bit inaccessible. In some desktop browsers with a mouse, you might be able to triple-click the line to select the URL and copy it, but you can’t count on everyone knowing that or that it’s possible in all scenarios.<\/p>\n\n\n\n

Overflow is the right word here as well, as that’s exactly what is happening. We have overflow: auto;<\/code> at our disposal as well, which would trigger a horizontal scrollbar. Maybe suitable sometimes, but I imagine we’ll all agree that’s not generally an acceptable solution.<\/p>\n\n\n\n

What we want is the dang long URL (or text of any kind) to break to the next line. There are options! Let’s start with a place to attempt figure this stuff out.<\/p>\n\n\n

Experimental Playground<\/h3>\n\n\n

My idea here is to have a resizeable panel of content combined with a variety of CSS property\/values that you can toggle on and off to see the effects on the content.<\/p>\n\n\n\n

This isn’t comprehensive or perfectly executed, I’m sure. It’s just some of the properties I’m aware of.<\/p>\n\n\n\n