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
  • 245,468
  • 26
  • 309
  • 415
Michael
  • 13,950
  • 57
  • 145
  • 288

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
  • 30,714
  • 6
  • 20
  • 43
-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
  • 53
  • 1
  • 9