I have a box with text-align: center
, with a max-width: 420px
. Inside the box there is a h1
with a very long word. (See the code example)
The Problem: The overflowing word is now left aligned. I know, there is word-wrap
for this, but I dont want to cut the text, it has to be on the same line. The width of the box is also fixed and can not be more.
My question: Is it possible to center align the big overflowing word?
.titles {
text-align: center;
padding: 3rem 0;
margin: 0 auto;
max-width: 420px;
background: lightgrey;
}
h1 {
font-size: 2.9rem;
margin: 0 0 1.9rem;
color: #3d78c7;
font-weight: 700;
line-height: 1.2;
}
<div class="titles">
<h1>Allgemeine Geschäftsbedingungen</h1>
</div>