2012-12-12 163 views

回答

2

爲內嵌內容添加負邊距不起作用(至少在大多數瀏覽器上)。如果要向上移動文本,可以相對放置元素,並將頂部設置爲負數。

.badge { 
    display: inline-block; 
    top: -2px; 
    position: relative; 
} 

http://jsfiddle.net/ThySQ/4/

0

您需要申請填充到div有專區內應用的額外空間。

.badge { 
    display: inline-block; 
    margin-top: -2px; 
    padding: 4px; /* sets up a 4px margin all around the inside edge of the div */ 

} 

這將影響div內的任何內容。