Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Header has 2 rows on the mobile

I got this but I don’t know why when I open it on mobile phone "Where to" is split into 2 rows. But when I open Chrome Developer tools it’s ok even with the minimum width of the page.

 /*Column*/
    .header {
        background-color: #fff;
        color: #000;
        box-shadow: 0 0 15px rgb(0 0 0 / 55%);
        width: fit-content;
        margin-left: auto;
        margin-right: auto;
    
    }
    #column {
        background-color: #fff;
        color: #000;
        text-align: center;
        display: table-cell;
        width: 33%;
        max-width: 50%;
    }
    .columnNad {
        color: #ff6347;
        font-weight: bold;
    }
    .columnText {
        color: #000;
    }
    
    
    <div class="header">Where to</div>
    <div id="column">
      <div class="columnNad">TEST</div>
      <div class="columnText">Test123Test123Test123Test123Test123Test123Test123Test123<br><br></div>
    </div>

enter image description here

Thank you

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Add white-space: nowrap; to .header.

.header {
  background-color: #fff;
  color: #000;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  white-space: nowrap; 
}

#column {
  background-color: #fff;
  color: #000;
  text-align: center;
  display: table-cell;
  width: 33%;
  max-width: 50%;
}

.columnNad {
  color: #ff6347;
  font-weight: bold;
}

.columnText {
  color: #000;
}
<div class="header">Where to</div>
<div id="column">
  <div class="columnNad">TEST</div>
  <div class="columnText">Test123Test123Test123Test123Test123Test123Test123Test123<br><br></div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading