I have an img and then a h1 beside it in a header. Here is the code:
<header class="site-header">
<img src="<?php bloginfo('template_directory');?>/logo.svg" alt="Logo" class="site-logo">
<div class="first-level-header">
<h1>Name of website</h1>
</div>
</header><!-- /site-header -->
And the css:
h1 {
display: inline;
font-family: sans-serif;
color: blue;
}
img.site-logo {
display: inline;
padding-top: 10px;
padding-left: 10px;
width: 125px;
height: 125px;
}
My question is: how do I have the h1 stay on the top instead of being aligned to the bottom of the image.
More information: This is a wordpress theme, if that means anything. I have also tried other tons of things, different images, different places in the document, changing the h1 to a p, etc.
Thanks in advance.
After testing for hours I found that if you surround the h1 with a div and set the div to vertical-align: top; it works.
Example:
HTML:
CSS:
You can try with a vertical-align element. For example, in your CSS you can add:
If you want next to that image follow this css:
If you want above the image follw this html: