我有这个结构: div class="gBigPage" span class="gBigMonthShort"FEB/spanbr / span class="gBigDayShort"23/spanbr / span class="gBigYearShort"2011/span/div 文本行之间的间隙太大,我需要它们缩短,所以它们几乎都是触摸
<div class="gBigPage"> <span class="gBigMonthShort">FEB</span><br /> <span class="gBigDayShort">23</span><br /> <span class="gBigYearShort">2011</span> </div>
文本行之间的间隙太大,我需要它们缩短,所以它们几乎都是触摸的.
/* 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; }
我无法对跨度进行相对定位,因为Chrome中存在一个闪烁鼠标悬停效果的错误,纯CSS是唯一可行的.
小提琴例如:
http://jsfiddle.net/GmKsv/
这是代码:
.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; }
演示于jsFiddle
希望能帮助到你!