我想介紹旁邊的另一個元素的複選框。問題是,a
元素已被CSS製作爲「塊」,因此它出現在正確的高度和寬度。作爲一個障礙,我不能簡單地在旁邊放置另一個元素,並希望它顯示在那裏 - 它顯示在它下面。CSS需要內聯元素出現在{display:block; }元素
一個自包含的示例如下所示。
<html>
<head>
<style type='text/css'>
/* I don't have control over this */
a.btn {
background-color: #B35905;
color: #E6D389;
text-decoration: none;
font-weight: bold;
text-align: center;
display: block;
border: none;
cursor: pointer;
}
.normal{
line-height: 20px;
font-size: 12px;
height: 20px;
width: 125px;
padding: 0px;
margin: 0px;
}
</style>
</head>
<body>
<!-- I have some control over this -->
<a class="btn normal">Push Me</a><input type="checkbox">
<br>
<a class="btn normal">Push Me Too</a>
</body>
</html>
所以,我正在尋找的是立即出現在元素的右邊的複選框,而無需完全弄髒的按鈕的樣式。使用按鈕的(已知)大小絕對定位複選框似乎是錯誤和髒的。
對此提出建議?
完美。謝謝。 – 2009-11-13 17:36:12
或只是將
更改爲
– jessegavin 2009-11-13 17:37:14