0
我粘貼在具有包含四個子div的容器類的div的HTML代碼片段的下面,該子div的類名爲「city」。無法在一條直線上對齊div標籤的文本框(css邊框)
我想通過應用bootstrap將它們排成一行。
我已將我的樣式表粘貼到HTML下面。我一直試圖通過增加和減少右側/左側邊距一個多小時,但無法正確使用它。
<!DOCTYPE html>
<html lang="en-us">
<head>
<link rel="stylesheet" type="text/css" href="./index.css">
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1 id="cities">Cities Of The World</h1>
<div class="city">
<h2>London</h2>
<p>London is the capital city of England.</p>
<p>It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.</p>
</div>
<div class="city">
<h2>Paris</h2>
<p>Paris is the capital of France.</p>
<p>The Paris area is one of the largest population centers in Europe, with more than 12 million inhabitants.</p>
</div>
<div class="city">
<h2>Tokyo</h2>
<p>Tokyo is the capital of Japan.</p>
<p>It is the center of the Greater Tokyo Area, and the most populous metropolitan area in the world.</p>
</div>
<div class="city">
<h2>New York</h2>
<p>The City of New York is the most populous city in the United States.</p>
<p>New York is an important center for international diplomacy and has been described as the cultural and financial capital of the world.</p>
</div>
</div>
</body>
</html>
#cities {
text-align: center;
padding: 20px;
}
.city {
display: inline-block;
margin: 10px;
padding: 15px;
max-width: 250px;
height: 300px;
border: 1px solid black;
}
是的。這有助於。謝謝。 –