I'm trying to break a sentence using CSS. I don't want to break the words, but break the sentence. So for example if there's a sentence like Hello world it's test. It should not break any of the words in that sentence and put it in a new line. It should only put new words in a new line. Here's the CSS that I have so far:
See attached image. Notice our some words break apart? I want a new word in a new line, not the characters in a single word to break.
.Main_Topics {
background: linear-gradient(90deg, rgba(0, 0, 0, 0.546) 0%, rgba(0, 0, 0, 0.539) 23.54%, rgba(0, 0, 0, 0.469) 46.07%, rgba(0, 0, 0, 0) 58.09%), url(/assets/jerry.jpg);
border-radius: 18px;
min-height: 424px;
width: 100%;
color: white;
padding: 47px 34px;
margin: 120px auto;
text-align: left;
background-size: cover;
background-repeat: no-repeat;
background-position: right top;
}
.Main_Topics h2 {
font-size: 40px;
margin-bottom: 30px;
}
.Main_Topics p {
max-width: 552px;
margin-bottom: 40px;
}
.Main_Topics .topic {
background: #FFFFFF;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
padding: 34px;
height: 150px;
text-align: center;
font-size: 14px;
color: #000000;
;
}
.category-wrapper {
position: relative;
max-width: 100%;
height: 150px;
margin: 0 auto;
overflow-x: hidden;
overflow-y: hidden;
}
.category-wrapper ul {
height: 150px;
box-sizing: border-box;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
}
.category-wrapper .topic {
display: inline-block;
width: 140px;
height: 150px;
margin-right: 26px;
overflow-wrap: normal;
vertical-align: top;
}
.category-wrapper .topic div {
word-wrap: break-word;
/* IE 5.5-7 */
white-space: -moz-pre-wrap;
/* Firefox 1.0-2.0 */
white-space: pre-wrap;
/* current browsers */
font-size: 14px;
height: 150px;
}
.paddle {
position: absolute;
top: 0;
bottom: 0;
width: 3em;
background: transparent;
border: none;
}
.left-paddle {
left: 0;
background: transparent;
border: none;
}
.right-paddle {
right: 0;
background: transparent;
border: none;
}
<div class="row Main_Topics">
<h2>What do you need help with?</h2>
<p>Our experts are one Zoom call area. They'll give you honest advice. No BS. Straightforward and to the point.</p>
<div class="category-wrapper">
<ul>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
<li class="topic">
<div>{{name}}</div>
</li>
</ul>
<div class="paddles">
<button class="left-paddle paddle hidden">
<img src="/assets/paddle-left.svg" />
</button>
<button class="right-paddle paddle">
<img src="/assets/paddle-right.svg" />
</button>
</div>
</div>
</div>
