【发布时间】:2014-06-19 07:18:15
【问题描述】:
HTML
<label for="home" class="prof">
<img src="http://bigbackground.com/wp-content/uploads/2013/05/modern-house.jpg" class="image-label" />
</label>
<input type="radio" name="type" value="home" id="home">
<label for="home" class="type">House Owner</label>
CSS
.image-label{
width: 168px;
height: 168px;
border-radius: 100%;
}
input[type="radio"]:not(:checked),
input[type="radio"]:checked {
visibility: hidden;
}
label {
position: relative;
display: inline-block;
cursor: pointer;
float: left;
text-align: center;
width: 200px;
}
input[type=radio] + .prof img:hover {
border: 15px solid red;
border-radius: 100%;
}
input[type=radio]:checked + .prof img {
border: 15px solid red;
border-radius: 100%;
}
input[type=radio]:checked + .prof img:hover {
border: 15px solid red;
border-radius: 100%;
}
试图在悬停图像时或单击并出现勾号后出现带有边框颜色的边框半径。带有边框颜色的边框半径似乎无法用于图像?因为我已经尝试在本地使用带有背景图像的标签并且它有效。然而,在标签上使用背景图像会导致刻度错误定位,尽管绝对定位。
帮助表示赞赏。
【问题讨论】:
-
最后一个属性块是没有用的,因为它得到的属性与输入是单选和图像悬停时相同。
标签: css