html - I have p element inside a div both have equal height 50px. Why is p shifted downwards? -


this new result after amit's answerenter image description hereboth p , div , have no margins or padding. shown

https://jsfiddle.net/4vqgj0qe/3/

here have 2 buttons named 'aug,' & '2017' in

element of id #semiscreen, inside element of id #button-bar other buttons. while other buttons in place. buttons inside p shifted little downwards(seems whole p shifted downwards) can seen in sep button in picture given. why shifted downwards , how show them other buttons?

html:

    <body>        <p id="demo"></p>        <input type="text" id="dateinput" name="dateinput">        <button>▼</button>        <div id="calender" style="display: block;"> <div class="button-bar">   <button>《</button>   <button>&lt;</button>   <p id="semiscreen">     <button>aug,</button>     <button>2017</button>   </p>   <button>&gt;</button>   <button>》</button> </div> <table id="caltable">   <tr>     <th>s</th>     <th>m</th>     <th>t</th>     <th>w</th>     <th>t</th>     <th>f</th>     <th>s</th>   </tr>   <tr>     <td></td>     <td></td>     <td>1</td>     <td>2</td>     <td>3</td>     <td>4</td>     <td>5</td>   </tr>   <tr>     <td>6</td>     <td>7</td>     <td>8</td>     <td>9</td>     <td>10</td>     <td>11</td>     <td>12</td>   </tr>   <tr>     <td>13</td>     <td>14</td>     <td>15</td>     <td>16</td>     <td>17</td>     <td>18</td>     <td>19</td>   </tr>   <tr>     <td>20</td>     <td>21</td>     <td>22</td>     <td>23</td>     <td>24</td>     <td>25</td>     <td>26</td>   </tr>   <tr>     <td>27</td>     <td>28</td>     <td>29</td>     <td>30</td>     <td>31</td>   </tr>   </table>   </div>   </body> 

css:

   * {        margin: 0px;        padding: 0px;    }     table, th, td {      border: 1px solid #f2f2f2;       font-size: 20px;    }     table {      border-collapse: collapse;    }    tr:nth-child(even) {      background-color: #f2f2f2;   }    td {       padding: 4px 10px;       text-align: center;   }    td:hover {       color: white;       background-color: #888;   }    body {       font-family: arial;   }    #calender {       position: relative;       z-index: 1;       display: none;   }    #calender table {       width: 287px;   }    div.button-bar {       height: 50px;       /*line-height: 100%;*/        width: 287px;   }    #semiscreen {       padding: 0px;       display: inline-block;       width: 127px;       margin: 0px;       height: 50px;       text-align: center;       line-height: 50px;       vertical-align: middle;   }    #calender div.button-bar button {       background: white;       height: 100%;       border: none;       margin: 0px;       width: 35px;       outline: none;   }    #calender div.button-bar button:hover {     color: white;     background-color: #888;   }     #calender div.button-bar #semiscreen button {      width: auto;    } 

remove

  vertical-align: middle; 

from #semiscreen in css

the calendar box small shift downwards in css due text characters in use render arrows.

this works me on standalone html page.

<div class="button-bar">       <button>&#171;</button>       <button>&lt;</button>       <p id="semiscreen">         <button>aug,</button>         <button>2017</button>       </p>       <button>&gt;</button>       <button>&#187;</button>     </div> 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -