用bootstrap制作一个带导航栏带侧边栏的购物主页,提供html等代码
时间: 2024-05-25 16:19:04 浏览: 180
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Bootstrap Shopping Homepage</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- Navigation Bar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Shopping Site</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Shop</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</div>
</nav>
<!-- Main Content -->
<div class="container-fluid">
<div class="row">
<!-- Sidebar -->
<div class="col-md-3 sidebar">
<h3>Categories</h3>
<ul>
<li><a href="#">Clothing</a></li>
<li><a href="#">Shoes</a></li>
<li><a href="#">Accessories</a></li>
</ul>
</div>
<!-- Products -->
<div class="col-md-9">
<h2>Featured Products</h2>
<div class="row">
<div class="col-md-4 product">
<img src="https://via.placeholder.com/150" alt="Product Image">
<h4>Product 1</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<button type="button" class="btn btn-primary">Add to Cart</button>
</div>
<div class="col-md-4 product">
<img src="https://via.placeholder.com/150" alt="Product Image">
<h4>Product 2</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<button type="button" class="btn btn-primary">Add to Cart</button>
</div>
<div class="col-md-4 product">
<img src="https://via.placeholder.com/150" alt="Product Image">
<h4>Product 3</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<button type="button" class="btn btn-primary">Add to Cart</button>
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<footer class="footer">
<div class="container">
<span class="text-muted">© 2020 Shopping Site</span>
</div>
</footer>
<!-- Bootstrap Scripts -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi4+nWf" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
/* CSS */
.sidebar {
background-color: #f5f5f5;
padding: 20px;
height: 100%;
}
.product {
margin-bottom: 20px;
}
.footer {
background-color: #f5f5f5;
padding: 20px;
text-align: center;
}
阅读全文