Reputation: 89
How to make sure if a span can't fit in the line, it goes to the next line, instead of having half of it in the current line and the remaining part in the next line?
<div class="col>
<p style="line-height: 3;">
<span id="tag">College Applications</span>
<span id="tag">Internships and Jobs</span>
<span id="social-tag">Pro Bono</span>
<span id="social-tag">People of Color</span>
</p>
</div>
<div class="col></div>
What it is right now:
What I want it to be
I looked into no-wrap style for div but then the column width gets affected by this, so this doesn't work.
Please don't say to just use "br" tag hahaha, it needs to be responsive for different devices.
Upvotes: 0
Views: 52
Reputation: 177860
You can try wbr and nbsp
And close your quotes and have unique IDs or use a class
.col {
width: 200px;
background-color: yellow
}
span {
padding: 5px;
}
<div class="col">
<p><span class="tag">College Applications</span><wbr/><span class="tag">Internships and Jobs</span><wbr/><span class="social-tag">Pro Bono</span><wbr/><span class="social-tag">People of Color</span></p>
</div>
Upvotes: 1