Warren Edy 12 Warren Edy 12 - 1 month ago 5
CSS Question

Move heading 1 and heading 2 to the right of image

I want to have

<h1>
and
<h2>
to the right of an image but
<h2>
must be under
<h1>
. How do I go about this?

My Code

<html>
<link rel="stylesheet" href="style.css">
<img src="images/SelzerSeal.jpg" alt="Henry Selzer attorney at law">
<h1>Test</h1><br>
<h2>Test 2</h2>
</html>


CSS

img {
max-width: 100%;
text-align: center;
float:left;
}
h1{
color:white;
font-size: 24px;
float:left;
font-family:"Book Antiqua";
}
h2 {
color:white;
font-size:20px;
float:left;
font-family:"Times New Roman";
}

Answer

You don't need to add float to either h1 or h2

See demo

<html>
<link rel="stylesheet" href="style.css">
<img src="images/SelzerSeal.jpg" alt="Henry Selzer attorney at law">
<h1>Test</h1>
<h2>Test 2</h2>
</html>

img {
max-width: 100%;
float:left;
margin-right: 1%}
h1{
color:white;
font-size: 24px;
font-family:"Book Antiqua";
}
h2 {
color:white;
font-size:20px;
font-family:"Times New Roman";
}