html5 - CSS layout bug with buttons and empty content -


i've got layout bug snippet below in ie11, chrome, firefox - second button not correctly inline first button.

the problem goes away add non-whitespace content inner span on second button.

is there css fix bring buttons inline without requiring actual content, ideally without changing rest of css?

<!doctype html>  <html>  <head>  <title>css problem</title>  <meta charset="utf-8"/>  <style>  .mainborder { padding: 20px; background-color: #254669 }        button {      font-family: verdana;      font-size: 13px;      color: white;      position: relative;      padding: 0 8px 1px 8px;       height: 24px;      background-color: #254669;      border: 1px solid #53779d;      transition: 150ms ease-out;      outline: none;  }    button:disabled {      opacity: 0.65;  }    button:enabled {      cursor: pointer;  }    button:hover:enabled {      background-color: #53779d;  }    button:active:enabled > span.content {      display: inline-block;      transform: translatey(-1px);  }    button:focus {      border-color: white;  }        button.iconbutton {      width: 24px;      padding: 0;  }    span.icon {      display: block;      height: 16px;  }  </style>  </head>  <body>      <h1>button</h1>      <div class="mainborder">          <button><span class="content">default</span></button>&nbsp;&nbsp;&nbsp;          <button class="iconbutton"><span class="icon"></span></button>&nbsp;&nbsp;&nbsp;      </div>  </body>  </html>

just add vertical-align:middle button clas this: demo

button {     font-family: verdana;     font-size: 13px;     color: white;     position: relative;     padding: 0 8px 1px 8px;     height: 24px;     background-color: #254669;     border: 1px solid #53779d;     transition: 150ms ease-out;     outline: none;     vertical-align:middle; /* added */ } 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -