P粉1555517282023-09-06 00:39:04
Is this what you want? I've added text-align: center;
to #texts
to center the two text elements. I have added parent #box1
and added display: flex; justify-content: center;
so basically I have used Flexbox horizontally Center #box1
. Looks like what you want.
h1 {
color: white;
font-family: "Libre Baskerville", cursive;
}
p {
color: white;
}
body {
background: black;
}
#texts {
text-transform: uppercase;
text-align: center;
}
#box1 {
border: 5px solid;
color: white;
width: 450px;
}
.container {
display: flex;
justify-content: center;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Libre+Baskerville&display=swap" rel="stylesheet" />
</head>
<body>
<div class="container">
<div id="box1">
<!-- <img src="max-harlynking-UdCNVHNgHdI-unsplash.jpg" alt="" width="100%" height="50%" /> -->
<img src="https://picsum.photos/640/480" alt="" width="100%" height="100%" />
</div>
</div>
<h1 id="texts">let's a go!!!</h1>
<p id="texts">we did it</p>
</body>
</html>