image of banner stand on the right side

Asked

Viewed 584 times

0

How do I get the image to be on the right side of the div? See below:

inserir a descrição da imagem aqui

The code I’m trying here is this:

<div class="img img-responsive" style="background-color: #1F356A;" align="right"> 
   <div style="background-image: url('banner/banner.png'); height: 100px;  margin-top: -23px; line-height: 100px; color: #BCA828; font-family: Arial; font-size: 48px; text-align: center">
       HISTÓRIA
    </div>
</div>
  • tries to put float: right

  • Hello Francisco. Unfortunately it didn’t work. The banner doesn’t appear anymore.

  • I recommend using flexbox is already accepted by 95% of browsers..

2 answers

1


To do this use the property background-position with the value right, following example:

seletor{
    background-position: right;
}

How do you want to position the background of the element, and not the element itself, the float: right doesn’t work!

  • 1

    Thanks Lucas. It worked!

0

Use Flexbox to adjust your elements with incredible simplicity!

.sua-classe-pai {
  display: flex;
  justify-content: flex-end; // flex-start é o padrão // center centraliza...
}

I recommend researching more on the subject!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.