Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS space lines between spans

Tags:

css

line

spacing

I have this structure:

<div class="gBigPage">
    <span class="gBigMonthShort">FEB</span><br />
    <span class="gBigDayShort">23</span><br />
    <span class="gBigYearShort">2011</span>
</div>

The gaps between the text lines are too big, I need them shortened so they are all virtually touching.

/* Mouseover div for day numbers */
.gBigPage{
    height:45px;
    width:30px;
    font-family:Arial;
    font-weight:bold;
    background-color:#ffee99;
    text-align:center;
    border-top:1px solid #c0c0c0;
    border-left:1px solid #c0c0c0;
    border-right:1px solid #c0c0c0;
    position:absolute;
    z-index:3;
}
.gBigPage:hover{
    cursor:pointer;
}
/* In the big day box, the month at top */
.gBigMonthShort{
    text-transform:uppercase;
    font-size:11px;
}
.gBigYearShort{
    font-size:11px;
}
.gBigDayShort{
    font-size:16px;
}

I can't do relative positioning for the spans, as there is a bug in Chrome which flickers the mouseover effect, pure CSS is the only thing that seems to work.

Fiddle for example: http://jsfiddle.net/GmKsv/

like image 848
Tom Gullen Avatar asked Sep 04 '26 03:09

Tom Gullen


2 Answers

All you need is line-hight in your css. Add this to your gBigPage.

Here is the code:

.gBigPage{
    height:45px;
    width:30px;
    font-family:Arial;
    font-weight:bold;
    background-color:#ffee99;
    text-align:center;
    border-top:1px solid #c0c0c0;
    border-left:1px solid #c0c0c0;
    border-right:1px solid #c0c0c0;
    position:absolute;
    z-index:3;
    line-height: 13px;
}

Demo on jsFiddle

Hope it helps!

like image 65
ryryan Avatar answered Sep 06 '26 05:09

ryryan


Use line-height in your css :) you can reduce the gap between lines

like image 33
benhowdle89 Avatar answered Sep 06 '26 05:09

benhowdle89



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!