I'm having trouble aligning my text next to a square div or span element.
I've experimented with using a div and floating the text, as well as trying a span with display: inline-block and display:block. Despite searching on Stack Overflow for solutions, nothing seems to work for me.
Here is the code snippet I am currently using:
.event-date{
background-color: #2C3846;
color: white;
width: 50px;
height: 50px;
margin: 20px;
text-align: center;
font-weight: bold;
text-transform: uppercase;
font-size: 12px;
}
.event-text{
float: left;
}
<body>
<div class="main-container">
<section class="col-content">
<main>
<h1>Our Events</h1>
<section>
<div class="event-date">9<br>Apr</div>
<h2 class="event-text">Discussion Meeting Europe</h2>
<p class="event-text"><q>What does Europe mean concretely for me in my everyday life as...</q></p>
</main>
</section>
</div>
</body>
I would like the 'h2' and 'p' elements to be positioned next to the blue square representing the event date. This layout will serve as an event listing template.