gpt4 book ai didi

html - 有没有办法将边框底部放在同一个 div 元素中

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

除了将 border-bottom 的 div 元素放在主 div 之外,有没有办法将 border-bottom 放在主 div 元素的内部。这是我想要发生的屏幕截图 https://i.imgur.com/jmAkBP7.png当您注意到有一条蓝线时,那将是边框底部。

html,
body {
margin: 0;
padding: 0;
}
.wrap {
height: 100vh;
display: grid;
grid-gap: 3px;
grid-template-columns: repeat(12, 1fr);
grid-template-rows: 100px auto 100px;
}

.headNav {
position: relative;
grid-column: 1 / -1;
overflow: hidden;
/* background: #000; */
}


.menu {
grid-column: 1 / 3;
grid-row: auto;
/* background: pink; */
}

.content {
grid-column: 3 / -1;
/* background-color: blue; */
}

.footer {
grid-column: 1 / -1;
/* background: #000; */
}

.body {
background-image: linear-gradient(
rgba(0, 31, 63, 0.958),
rgba(0, 31, 63, 0.958) )
,url(./img/bgmain.jpg);
background-size: cover;
}

.logo {
display: inline;
}

.logo > img {
display: inline;
padding-top: 10px;
height:80px;
padding-left: 20px;
}

.link, ul, li {
display: inline;
list-style-type: none;
}

.link {
position: absolute;
top: 45px;
left: 32.2%;
}

li a {
font-family: 'Raleway', sans-serif;
font-weight: 900;
text-transform: uppercase;
text-decoration: none;
font-size: 20px;
color: #fff;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Jury Gregorio - Homepage</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="main.css">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
</head>
<body>
<div class="wrap body">
<div class="headNav">
<div class="logo"><img src="./img/logo.png" alt="Logo"></div>
<div class="link">
<ul><li><a href="">Home</a></li></ul>
<ul><li><a href="">About</a></li></ul>
<ul><li><a href="">Blog</a></li></ul>
<ul><li><a href="">Contact</a></li></ul>
</div>
</div>
<div class="menu"></div>
<div class="content"></div>
<div class="footer"></div>
</div>
</body>
</html>

最佳答案

像这样:

html,
body {
margin: 0;
padding: 0;
}
.wrap {
height: 100vh;
display: grid;
grid-gap: 3px;
grid-template-columns: repeat(12, 1fr);
grid-template-rows: 100px auto 100px;
}

.headNav {
position: relative;
grid-column: 1 / -1;
overflow: hidden;
/* background: #000; */
}


.menu {
grid-column: 1 / 3;
grid-row: auto;
/* background: pink; */
}

.content {
grid-column: 3 / -1;
/* background-color: blue; */
}

.footer {
grid-column: 1 / -1;
/* background: #000; */
}

.body {
background-image: linear-gradient(
rgba(0, 31, 63, 0.958),
rgba(0, 31, 63, 0.958) )
,url(./img/bgmain.jpg);
background-size: cover;
}

.logo {
display: inline;
}

.logo > img {
display: inline;
padding-top: 10px;
height:80px;
padding-left: 20px;
}

.link, ul, li {
display: inline;
list-style-type: none;
}

.link {
position: absolute;
top: 45px;
left: 32.2%;
}

li a {
font-family: 'Raleway', sans-serif;
font-weight: 900;
text-transform: uppercase;
text-decoration: none;
font-size: 20px;
color: #fff;
}

ul {
border-bottom: 2px solid blue;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Jury Gregorio - Homepage</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="main.css">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
</head>
<body>
<div class="wrap body">
<div class="headNav">
<div class="logo"><img src="./img/logo.png" alt="Logo"></div>
<div class="link">
<ul>
<li><a href="">Home</a></li>
<li><a href="">About</a></li>
<li><a href="">Blog</a></li>
<li><a href="">Contact</a></li>
</ul>
</div>
</div>
<div class="menu"></div>
<div class="content"></div>
<div class="footer"></div>
</div>
</body>
</html>

关于html - 有没有办法将边框底部放在同一个 div 元素中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54768410/

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