I am struggling to align the elements in my HTML and CSS prototype. This image shows what I am trying to achieve.
I attempted to use display: flex
and justify content: center
to center the main div. However, I encountered difficulties in positioning the p
elements to the left of the centered div. I tried using margin-right: auto
for p
, but it did not produce the desired result.
Below is the code snippet I have been working on:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
.wrap {
display: flex;
justify-content: center;
border: red 5px solid;
}
p {
display: flex;
margin-right: auto;
color: blue;
}
</style>
<body>
<div class="wrap">
<p>lorem ipsum</p>
</div>
</body>
</html>
Any assistance or advice on how to correctly align these elements would be greatly appreciated. Thank you!