用html语言制作一个包含grid intro form table carousel button jumbotron card collapse modal shape media的网页
时间: 2023-06-17 22:07:52 浏览: 101
下面是一个使用 HTML 和 Bootstrap 的网页示例,其中包含了grid、intro、form、table、carousel、button、jumbotron、card、collapse、modal、shape和media元素:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bootstrap Example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</head>
<body>
<!-- Grid -->
<div class="container">
<div class="row">
<div class="col-sm-4">1</div>
<div class="col-sm-4">2</div>
<div class="col-sm-4">3</div>
</div>
</div>
<!-- Intro -->
<div class="jumbotron text-center">
<h1>Welcome to my website</h1>
<p>Enjoy your stay!</p>
</div>
<!-- Form -->
<div class="container">
<form>
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name">
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<!-- Table -->
<div class="container">
<table class="table">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>john@example.com</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>mary@example.com</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>july@example.com</td>
</tr>
</tbody>
</table>
</div>
<!-- Carousel -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="carousel-item active">
<img src="https://via.placeholder.com/800x400?text=Slide+1" alt="Slide 1">
</div>
<div class="carousel-item">
<img src="https://via.placeholder.com/800x400?text=Slide+2" alt="Slide 2">
</div>
<div class="carousel-item">
<img src="https://via.placeholder.com/800x400?text=Slide+3" alt="Slide 3">
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
</a>
<a class="carousel-control-next" href="#myCarousel" data-slide="next">
<span class="carousel-control-next-icon"></span>
</a>
</div>
<!-- Button -->
<div class="container">
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-light">Light</button>
<button type="button" class="btn btn-dark">Dark</button>
</div>
<!-- Jumbotron -->
<div class="jumbotron">
<h1>My First Bootstrap Page</h1>
<p>Resize this responsive page to see the effect!</p>
</div>
<!-- Card -->
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="card">
<img class="card-img-top" src="https://via.placeholder.com/350x150?text=Card+1" alt="Card 1">
<div class="card-body">
<h4 class="card-title">Card 1</h4>
<p class="card-text">Some example text.</p>
<a href="#" class="btn btn-primary">Read more</a>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<img class="card-img-top" src="https://via.placeholder.com/350x150?text=Card+2" alt="Card 2">
<div class="card-body">
<h4 class="card-title">Card 2</h4>
<p class="card-text">Some example text.</p>
<a href="#" class="btn btn-primary">Read more</a>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card">
<img class="card-img-top" src="https://via.placeholder.com/350x150?text=Card+3" alt="Card 3">
<div class="card-body">
<h4 class="card-title">Card 3</h4>
<p class="card-text">Some example text.</p>
<a href="#" class="btn btn-primary">Read more</a>
</div>
</div>
</div>
</div>
</div>
<!-- Collapse -->
<div class="container">
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Simple collapsible</button>
<div id="demo" class="collapse">
Some text to collapse.
</div>
</div>
<!-- Modal -->
<div class="container">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">Open modal</button>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Modal Title</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
<!-- Shape -->
<div class="container">
<div class="row">
<div class="col-sm-6">
<div class="triangle-up"></div>
</div>
<div class="col-sm-6">
<div class="triangle-down"></div>
</div>
</div>
</div>
<!-- Media -->
<div class="container">
<div class="media">
<img src="https://via.placeholder.com/64x64?text=Avatar" class="mr-3" alt="...">
<div class="media-body">
<h5 class="mt-0">Media heading</h5>
<p>Some text.</p>
</div>
</div>
</div>
</body>
</html>
```
你可以复制上述代码,并保存为一个 .html 文件,然后在浏览器中打开它来查看这个网页的效果。
阅读全文