Html 在y位置固定div,但不在x位置,具体取决于其他div
我有一个侧边栏和导航栏,我想知道是否有可能根据每一篇文章的宽度调整侧边栏的x位置 HTML:Html 在y位置固定div,但不在x位置,具体取决于其他div,html,css,sidebar,Html,Css,Sidebar,我有一个侧边栏和导航栏,我想知道是否有可能根据每一篇文章的宽度调整侧边栏的x位置 HTML: <div id="sidebar"> </div> 在文章里面设置边栏怎么样 HTML: 什么是x位置。。?你想如何适应它。。? div#sidebar{ width: 200px; height: 100%; position: fixed; margin-top: 50px; float: left; } <div id="a
<div id="sidebar">
</div>
在文章里面设置边栏怎么样 HTML: 什么是x位置。。?你想如何适应它。。?
div#sidebar{
width: 200px;
height: 100%;
position: fixed;
margin-top: 50px;
float: left;
}
<div id="article">article
<div id="sidebar">sidevar
</div>
</div>
#article
{
margin-left: 30px;
background: white;
width: 200px;
height: 300px;
}
#sidebar
{
position: fixed;
top: 0px;
width: 30px;
height: 100%;
background: blue;
color: white;
}