CSS: keep multiple elements in same place -


i writing calendar , trying keep calendar numbers contained in divs in same place. however, when add text event in div, text seems pushing numbers upwards. reading gather has block elements pushing 1 around vertically. have set position in both number div , event div relative because if shift absolute, of elements printed on top of 1 another. , i've tried sorts of other combinations of css tags no avail.

here jsfiddle illustrating problem , code:

css

table.calendar {     table-layout: fixed;     width: 520px; } div.day-number   {      background:#999;      z-index:2;      top:0px;      right:1px;      padding:4px;      color:#fff;      font-weight:bold;      width:18px;      text-align:center; } td.calendar-day, td.calendar-day-np {      width:70px;      padding:5px 25px 5px 5px;      border-bottom:1px solid #999;      border-right:1px solid #999;  } div.event {     position:relative;      z-index:3;      top:15px;     text-width: 70px; } 

html

<table class="calendar">     <tr>         <td>mon</td>         <td>tue</td>         <td>wed</td>         <td>thur</td>         <td>fri</td> </tr> <tr>          <td class="calendar-day"><div class="day-number">14</div><p>&nbsp;</p><p>&nbsp;</p></div></td>     <td class="calendar-day"><div class="day-number">15</div><p>&nbsp;</p><p>&nbsp;</p></div></td> <td class="calendar-day"><div class="day-number">16</div><div class="event">4:00pm<br>go gym</div><p>&nbsp;</p><p>&nbsp;</p></td>     <td class="calendar-day"></td>     <td class="calendar-day"><div class="day-number">18</div><p>&nbsp;</p><p>&nbsp;</p></div></td>             </tr></table> 

can suggest fix problem. in advance.

here js fiddle of how think should done,

http://jsfiddle.net/carlg/fcq3u/

you notice have not used table structure.

table used tabular data don't think quite falls calendar category, reason using table restrict how can manipulate , feel of calendar using css.

instead have used div tags.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -