Html 包含绝对Div的内联相对Div
以下是我的标记:Html 包含绝对Div的内联相对Div,html,css,Html,Css,以下是我的标记: .play-controls { .fa-play, .fa-pause { font-size: 25px; } } .volume-controls { display: inline-block; position: relative; .overlay { background-color: $highlight; height: 10px;
.play-controls {
.fa-play, .fa-pause {
font-size: 25px;
}
}
.volume-controls {
display: inline-block;
position: relative;
.overlay {
background-color: $highlight;
height: 10px;
border-radius: 5px;
width: 0px;
position: absolute;
z-index: 15;
}
.background {
background-color: $text-color;
width: 100px;
height: 10px;
border-radius: 5px;
position: absolute;
z-index: 10;
}
.circle {
border-radius: 100%;
position:absolute;
background-color: #fff;
border: 1px solid;
height: 15px;
width: 15px;
z-index: 20;
top: -3px;
}
}
.player {
#album-artwork {
width: 80px;
height: 80px;
vertical-align: middle;
display:inline-block;
margin-right: 10px;
}
.wrapper {
display:inline-block;
.information {
margin-bottom: 5px;
#song-title {
font-size: 22px;
font-weight:bold;
margin-right: 5px;
}
#artist-album {
font-size: 18px;
}
}
.progress-bar {
position: relative;
.overlay {
background-color: $highlight;
height: 10px;
border-radius: 5px;
width: 0px;
position: absolute;
z-index: 15;
}
.background {
background-color: $text-color;
width: 600px;
height: 10px;
border-radius: 5px;
position: absolute;
z-index: 10;
}
.circle {
border-radius: 100%;
position:absolute;
background-color: #fff;
border: 1px solid;
height: 15px;
width: 15px;
z-index: 20;
top: -3px;
}
}
}
}
单干
贝克-盖罗
在音量控制
中,具有类背景
、圆圈
和叠加
的div都是位置:绝对带有音量控制的code>作为位置:相对代码>
当制作播放控件
、音量控件
和播放器
内联时,播放控件
与音量控件
内联,但音量控件
与播放器重叠
我怎样才能把所有的东西都放在一行,而不重叠
编辑:您可以浮动:左代码>3个主要部分或显示:内联块编码>它们播放器
在音量控制上的问题
是因为音量控制中的绝对定位元素
。您可以在音量控制中添加宽度
.volume-controls {
display: inline-block;
position: relative;
width:150px;
}
这是一个问题有没有一种方法可以在不需要浮动的情况下完成你在那里做的事情?我更喜欢不用浮动。@JaredCubilla您可以使用display:inline block
。但由于定位的元素,需要宽度。它不计算宽度,因为它没有内容。位置发生在新的“层”上,因此音量控制
没有宽度