(html+css) Tel button splits into 2 lines on mobile, how can I make it responsive?

Viewed 344

I am trying to make the telephone button responsive on mobile.

In my browser's developer tools everything seems good in every mobile screen resolution, but when I access the site from mobile the phone number is split into 2 lines, instead of making it one line in a box.

Example

html

<a href="tel:+972504751410" class="call call1" id="call call1"> 050-475-1410 </a>

css :

* {
  margin: 0;
  padding: 0;
}

body {
  overflow: scroll;
  margin: 0;
  font-size: 17px;
  color: black;
  line-height: 1.4;
}

@media only screen and (max-width: 2000px) {
    .call {
    /*Your styles on small screen - example only*/
    width: 200px;
    font-size: 30px;
    .span{display: inline;}
    }
}
@media only screen and (max-width: 600px) {
    .call {
    /*Your styles on small screen - example only*/
    width: 150px;
    font-size: 25px;
    .span{display: inline;}
    }
}

@media only screen and (max-width: 370px) {
    .call {
    /*Your styles on small screen - example only*/
    width: 125px;
    font-size: 20px;
    .span{display: inline;}
    }
}

@media only screen and (max-width: 330px) {
    .call {
    /*Your styles on small screen - example only*/
    width: 120px;
    font-size: 20px;
    .span{display: inline;}
    }
}

.call {
  color: #2c3e50;
  background: none;
  border: 1px solid #2c3e50;
  text-align: center ;
  padding: 10px, 20px;
  margin: 5px;
  font-family: font1;
  text-decoration: none;
  position: relative;
  cursor: pointer;
  top: 2px;
}

1 Answers

HTML treats hyphen text as words, that's why they break down on small screen.

use white-space: nowrap;

also you can use these hyphen uni-codes &#x2011; or &#8209;

Related