我有一些要求需要使用my-control类jsfiddle,
将给定的内联css元素转换为外部css <div class="control my-control">
<div style="float: left;">
<div style="padding-left: 3px; padding-top: 3px;">
<div style="float: left;">Title:</div>
<div style="float: left; padding-left: 12px"></div>
<div style="clear: both"></div>
</div>
<div style="padding-left: 3px; padding-top: 3px;">
<div style="float: left;">Lyrics: </div>
<div style="float: left; padding-left: 3px">
<div style="overflow: hidden; width: 180px; white-space: nowrap;" class="lyric-content"></div>
</div>
<div style="clear: both"></div>
</div>
</div>
<div style="float: right; border-left: 1px solid black;">
<img src="Content/Images/play.png" style="height: 50px;"></div>
</div>
答案 0 :(得分:2)
.control.my-control {
overflow: hidden;
display: block;
border: 1px solid black;
margin: 15px;
width: 300px;
}
.control.my-control > div {
float: left;
}
.control.my-control > div + div {
float: right;
border-left: 1px solid black;
}
.control.my-control > div + div > img {
height: 50px;
}
.control.my-control > div > div {
padding-left: 3px;
padding-top: 3px;
}
.control.my-control > div > div > div {
float: left;
}
.control.my-control > div > div > div:last-child {
float: none;
clear: both;
}
.control.my-control > div > div > div + div {
padding-left: 12px;
}
.control.my-control > div > div + div > div + div {
padding-left: 3px;
}
.control.my-control > div > div > div > div.lyric-content {
overflow: hidden;
width: 180px;
white-space: nowrap;
}