我正在尝试使用我自己的风格&重新创建此website引导。
我无法弄清楚如何水平对齐这两个元素。
我希望左侧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>
答案 0 :(得分:0)
你有两个不同的行div,所以它们出现在两个不同的行中。尝试将HTML更改为以下内容:
{{1}}
答案 1 :(得分:0)
您必须在一行中使用Bootstrap cols。例如,如果要分为3列,则必须使用:
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4"></div>
<div class="col-md-4"></div>
</div>
现在,在您的网站中,您希望将一行分为2列3和9,因此您必须这样做:
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-9"></div>
</div>
如果不是很好的理由,我建议你避免使用“col-lg”,col-md在大屏幕和中等屏幕上工作得非常好!
我给你的codepen解决了你的问题:
https://codepen.io/Kristain/pen/GEVYyb
祝你好运!