gpt4 book ai didi

html - 如何使用 CSS/Bootstrap 网格系统水平排列两行?

转载 作者:行者123 更新时间:2023-11-28 03:20:48 25 4
gpt4 key购买 nike

我正在尝试重新创建此 website使用我自己的样式和 Bootstrap。

我不知道如何水平对齐这两个元素。

我想要左侧 nav bar 的网格大小为 3,右侧页面的其余部分为 9,我有,但是当我添加视频时,它只是垂直堆叠而不是水平堆叠。

   ul {
list-style: none;

}

.nav-left-bar {
text-transform: uppercase;
font-size: 9px;
font-family: Arial;
}

#search-but {
list-style: none;
border-bottom: 1px solid #000;
width: 18%;
padding-bottom: 1%;
margin: 5% 0 10% 0;
}

a:link, a:visited, a:active {
text-decoration: none;
color: #000;
}

a:hover {

}

#search-but:hover {
border-top: 1px solid #000;
border-left: 1px solid #000;
border-right: 1px solid #000;
padding-right: 50%;
}

video {
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
float: right;
}

.vid-marg {


}
 <!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>YSL</title>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-
BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
<link rel="stylesheet" type="text/css"
href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-
awesome.min.css">
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>

<div class="container">
<div class="nav-left-bar">
<div class="row">
<div class="col col-md-3">
<img src="ysllogo.jpg">
<ul>
<li>winter 17 collection</li>
</ul>

<ul>
<li>la maison</li>
<li>saint laurent collections</li>
<li>saint laurent store locator</li>
</ul>

<ul>
<li>shop women</li>
<li>shop men</li>
<li>sunglasses collection</li>
</ul>

<ul>
<li id="search-but"><a href="#">search</a></li>
</ul>

<ul>
<li id="bag-items">bag</li>
</ul>
<div class="bottom-navi-bar">
<ul>

<li>log in / register</li>
<li>newsletter</li>
<li>customer care</li>
<li>shipping to: us</li>
<li>legal notices</li>
<li>follow us</li>
</ul>
</div>
</div>
</div>
</div>


<div class="row">
<div class="col col-md-9">
<video src="https://md.yoox.biz/618203721001/201707/263/618203721001_5506271544001_5506259873001.mp4" autoplay=""></video>
</div>
</div>
</div>




<script
src="http://code.jquery.com/jquery-3.2.1.js"
integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE="
crossorigin="anonymous"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>


</body>
</html>


最佳答案

您将它们放在两个不同的行 div 中,因此它们会显示在两个不同的行中。尝试将您的 HTML 更改为如下内容:

<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Purrfect Match</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>

<div class="container">
<div class="nav-left-bar">
<div class="row">
<div class="col col-lg-3">
<img src="ysllogo.jpg">
<ul>
<li>winter 17 collection</li>
</ul>

<ul>
<li>la maison</li>
<li>saint laurent collections</li>
<li>saint laurent store locator</li>
</ul>

<ul>
<li>shop women</li>
<li>shop men</li>
<li>sunglasses collection</li>
</ul>

<ul>
<li id="search-but"><a href="#">search</a></li>
</ul>

<ul>
<li id="bag-items">bag</li>
</ul>
<div class="bottom-navi-bar">
<ul>

<li>log in / register</li>
<li>newsletter</li>
<li>customer care</li>
<li>shipping to: us</li>
<li>legal notices</li>
<li>follow us</li>
</ul>
</div>
</div>
<div class="col col-lg-9">
<video src="https://md.yoox.biz/618203721001/201707/263/618203721001_5506271544001_5506259873001.mp4" autoplay=""></video>
</div>
</div>
</div>
</div>


<!-- SCRIPTS -->

<script
src="http://code.jquery.com/jquery-3.2.1.js"
integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE="
crossorigin="anonymous"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

<!-- SCRIPTS -->
</body>
</html>

关于html - 如何使用 CSS/Bootstrap 网格系统水平排列两行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45227124/

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