0

.left {
      float: left;
      width: 75%;
      padding: 1px;
      border: 2px solid #eff0f0;
      font-weight: 450;
      font-size: 14px;
      border-right: none;
      text-align: center;  
    }
<div class="left">https://temo.derocitycapul.com/?code=1234567</div>

Here how it looks on the browser:

enter image description here

And here how it looks on the small window browser:

enter image description here

My question is how to prevent sliding the text to another row and make the text inside the div to be in a single line in any browser window size.

Temani Afif
  • 211,628
  • 17
  • 234
  • 311
Michael
  • 12,788
  • 49
  • 133
  • 253

2 Answers2

1

white-space:nowrap should do the trick. Use overflow-x:auto to make it scrollable:

.left {
  float: left;
  width: 75%;
  padding: 1px;
  border: 2px solid #eff0f0;
  font-weight: 450;
  font-size: 14px;
  border-right: none;
  text-align: center;  
  white-space:nowrap;
  overflow-x:auto;
}
div{
  width:100px !important;
}
<p>With white-space:nowrap: </p><div class="left">https://temo.derocitycapul.com/?code=1234567</div><br/>
<p>Without: </p><div class="left" style="white-space:initial">https://temo.derocitycapul.com/?code=1234567</div>
Spectric
  • 27,594
  • 6
  • 14
  • 39
-1

You can try this way

.left {
  float: left;
  width: 200px;
  padding: 1px;
  border: 2px solid #eff0f0;
  font-weight: 450;
  font-size: 14px;
  border-right: none;
  text-align: center;  
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
<div class="left">https://temo.derocitycapul.com/?code=1234567</div>
Apon Ahmed
  • 55
  • 9