gpt4 book ai didi

html - 我怎样才能把这个 div 放在另一个旁边?

转载 作者:太空宇宙 更新时间:2023-11-03 22:38:30 25 4
gpt4 key购买 nike

我想做一个网站,只是想看看我是否喜欢这样做以及结果如何,但我似乎无法完成这一部分。我希望“informatie”div 位于“vertmenu”div 旁边并使其填满白色部分,我希望“vertmenu”div 延伸到“voetregel”div。我不知道如何完成这项工作,我已经尝试过将宽度和高度更改为百分比,将位置更改为绝对/相对并添加一个 float 属性,但我无法按照我想要的方式进行设置。所以我的问题简而言之,我怎样才能在“vertmenu”div 旁边制作“informatie”div 并使其填满白色部分并让“vertmenu”div 延伸到“voetregel”div。

body {
margin:0;
padding:0;
background-color:#ffffff;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
}

#hormenu {
background-color: rgba(0, 0, 0, 0.5);
position:relative;
text-align: center;
width:100%;
height:15%;
line-height:50px;
font-size:100%;
}

#vertmenu {
background-color: rgba(255,0,0, 0.3);
position:relative;
height:100px;
top:15%;
width:15%;
margin:0px 0px 0px 0px;
padding:3px;
overflow:hidden;
}

#informatie {
background-color: rgba(0,0,255, 0.3);
position:relative;
float:left;
height:100%;
width:85%;
left: calc(15% + 6px);
margin:0px 0px 0px 0px;
padding:3px;
overflow:hidden;
}

#voetregel {
background-color: rgba(0,255,0, 0.3);
position:fixed;
width:100%;
height:100px;
top:auto;
right:0;
bottom:0;
margin-left:10px
}

a.hormenu_item {
margin: 10px;
transition: color 0.3s, text-shadow 0.3s, text-decoration-line 0.3s, font 0.3s ease-in-out;
}

a:link.hormenu_item {
color: white;
text-decoration: none;
}

a:visited.hormenu_item {
color: white;
text-decoration: none;
}

a:hover.hormenu_item {
color: gold;
text-decoration:none;
text-shadow: 0px 0px 7px gold;
font-size: 30px;
}

#informatie h1, #vertmenu h1, #voetregel h2 {
color:#FF0000;
font-size:20px;
}
<body>

<div id="hormenu">
<a href="" class="hormenu_item">Home</a>
<a href="" class="hormenu_item">Biografie</a>
<a href="" class="hormenu_item">Features</a>
<a href="" class="hormenu_item">Contact</a>
</div>

<div id="vertmenu">
<h1>vertmenu</h1>
</div>

<div id="informatie">
<h1>informatie</h1>
</div>

<div id="voetregel">
<h2>voetregel</h2>
</div>

</body>

最佳答案

在#vertmenu 和#informatie 中应用float:left; css

并且不要在#voetregel 中使用position:fixed; 使用clear:both; 它将清除上面2 个div 标签的 float 效果

position:fixed; 用于在网站中创建菜单栏,这样即使滚动菜单栏也保持在同一个位置

关于html - 我怎样才能把这个 div 放在另一个旁边?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45118458/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com