I'm creating a theme from scratch in Wordpress, and I would like to make a background with a custom image in the header. I'm trying to do it on the same front-page.php.
First, I tried to access the image through the path:
img / background.jpg
And it did not work. At first I added the image to the library. It retrieved the entire address as if it were up, so I was able to add the image via a specific path.
However, how do I customize the image? I want to make the site responsive, and I need to access both the image and the div that surrounds it.
The code:
front-page.php
<div class="header-image">
<img src="enderecoDaImagem/background.jpg" alt="Roma" />
</div><!-- /header-image -->
<?php if (have_posts()) :
while (have_posts()) : the_post();
the_content();
endwhile;
else :
echo '<p> Não tem Posts </p>';
endif;
?>
style.css
img{
text-align: center;
max-width: 100%; /*Isso faz com que a imagem não saia de dentro do wrapper.*/
height: auto;
}
.header-image{
border: 3px solid red;
max-width: 1000px;
}
Not even putting a border in the class it is applied.
That is, the image appears, but I can not customize it.