我正在尝试使用col-sm-3
让每个标题在各自的列中对齐,但我似乎没有任何运气。
这是一个类似于显示我正在努力实现的页脚的图像:
.footer {
margin-top: 100px;
margin-bottom: 100px;
background-color: #34495e;
}
.footer-title h6 {
font-family: 'Open sans', sans-serif;
color: #ffffff;
}
a:hover a:link {
text-decoration: none;
}
<!doctype html>
<html lang="en">
<head>
<title>Home </title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="shortcut icon" href="img/favicon_head.ico" />
<!-- Google fonts-->
<link href="https://fonts.googleapis.com/css?family=Lato|Open+Sans" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<!--NAVIGATION-->
<div class="container-bg-signup">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="signup">
<div class="signup text-center">
<h4>JOIN OUR MAILING LIST!</h4>
<div class="input-group justify-content-center">
<input type="email" id="myEmail" value="enter your email">
<button onclick="myFunction()" class="btn btn-light-orange btn-sign">SUBSCRIBE</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="container-fluid footer">
<div class="row">
<div class="col-sm-3">
<div class="footer">
<div id="cat-1">
<h6 class="footer-title">About
<h6>
<ul>
<a href="###">
<li>About Company</li><a/>
<a href="###">
<li>Vison & Mission</li><a/>
<a href="###">
<li>Parnters</li><a/>
<a href="###">
<li>Policy</li><a/>
</ul>
</div>
</div>
<div class="col-sm-3">
<div id="cat-2">
<h6 class="footer-title">Useful Links</h6>
<ul>
<a href="###">
<li>Help</li> <a/>
<a href="###">
<li>testimonials</li><a/>
<a href="###">
<li>Store Location</li><a/>
<a href="###">
<li>Trade Account</li><a/>
<a href="###">
<li>Site Map</li><a/>
</ul>
</div>
</div>
<div class="col-sm-3">
<div id="cat-3">
<h6 class="footer-title">Customers</h6>
<ul>
<a href="###">
<li>Our Prices</li><a/>
<a href="###">
<li>Returns</li><a/>
<a href="###">
<li>Sizes</li><a/>
<a href="###">
<li>Regster</li><a/>
</ul>
</div>
</div>
<div class="col-sm-3">
<div id="cat-4">
<h6 class="footer-title">Documentation</h6>
<ul>
<a href="###">
<li>RISQS Certificate</li><a/>
<a href="###">
<li>Insurance</li><a/>
<a href="###">
<li>Libray</li><a/>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</footer>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.4.5/js/mdb.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>
答案 0 :(得分:1)
如果我正确理解您的问题,并且您希望页脚标记中的所有四个col-sm-3列对齐?然后删除您在代码中添加的额外<div class="footer">
,因为您已经调用了顶部div中的.footer
类。像这样:<footer class="container-fluid footer">
原始代码:
<footer class="container-fluid footer">
<div class="row">
<div class="col-sm-3">
<!-- REMOVE --> <div class="footer">
<div id="cat-1">
<h6 class="footer-title">About
<h6>
<ul>
<a href="###">
<li>About Company</li><a/>
<a href="###">
<li>Vison & Mission</li><a/>
<a href="###">
<li>Parnters</li><a/>
<a href="###">
<li>Policy</li><a/>
</ul>
</div>
</div>
<div class="col-sm-3">
<div id="cat-2">
<h6 class="footer-title">Useful Links</h6>
<ul>
<a href="###">
<li>Help</li> <a/>
<a href="###">
<li>testimonials</li><a/>
<a href="###">
<li>Store Location</li><a/>
<a href="###">
<li>Trade Account</li><a/>
<a href="###">
<li>Site Map</li><a/>
</ul>
</div>
</div>
<div class="col-sm-3">
<div id="cat-3">
<h6 class="footer-title">Customers</h6>
<ul>
<a href="###">
<li>Our Prices</li><a/>
<a href="###">
<li>Returns</li><a/>
<a href="###">
<li>Sizes</li><a/>
<a href="###">
<li>Regster</li><a/>
</ul>
</div>
</div>
<div class="col-sm-3">
<div id="cat-4">
<h6 class="footer-title">Documentation</h6>
<ul>
<a href="###">
<li>RISQS Certificate</li><a/>
<a href="###">
<li>Insurance</li><a/>
<a href="###">
<li>Libray</li><a/>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</footer>
新代码:
<footer class="container-fluid footer">
<div class="row">
<div class="col-sm-3">
<div id="cat-1">
<h6 class="footer-title">About
<h6>
<ul>
<a href="###">
<li>About Company</li><a/>
<a href="###">
<li>Vison & Mission</li><a/>
<a href="###">
<li>Parnters</li><a/>
<a href="###">
<li>Policy</li><a/>
</ul>
</div>
</div>
<div class="col-sm-3">
<div id="cat-2">
<h6 class="footer-title">Useful Links</h6>
<ul>
<a href="###">
<li>Help</li> <a/>
<a href="###">
<li>testimonials</li><a/>
<a href="###">
<li>Store Location</li><a/>
<a href="###">
<li>Trade Account</li><a/>
<a href="###">
<li>Site Map</li><a/>
</ul>
</div>
</div>
<div class="col-sm-3">
<div id="cat-3">
<h6 class="footer-title">Customers</h6>
<ul>
<a href="###">
<li>Our Prices</li><a/>
<a href="###">
<li>Returns</li><a/>
<a href="###">
<li>Sizes</li><a/>
<a href="###">
<li>Regster</li><a/>
</ul>
</div>
</div>
<div class="col-sm-3">
<div id="cat-4">
<h6 class="footer-title">Documentation</h6>
<ul>
<a href="###">
<li>RISQS Certificate</li><a/>
<a href="###">
<li>Insurance</li><a/>
<a href="###">
<li>Libray</li><a/>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</footer>