samedi 20 octobre 2018

HTML Anchor Button Problems

I'm trying to create a button towards the bottom of my website.

Here's my HTML

<center><a href="#" id="btn1" class="btn1">
    View 
</a></center>

Here's my CSS.

.btn1 {
    margin: 60px 0px 60px 0px;
    color: white;
    background: #ED7836;
    padding: 10px 30px 10px 30px;
    text-decoration: none;
    font-size: 20px;
}

When I try creating the button, it seems to ignore my set margins and align itself right at the very bottom of the page.

Bottom of page

When I try to set its positioning to absolute and putting left: 50% it seems to position itself at a weird location that is not in the centre.

.btn1 {
    position: absolute;
    left: 50%;
    margin: 60px 0px 60px 0px;
    color: white;
    background: #ED7836;
    padding: 10px 30px 10px 30px;
    text-decoration: none;
    font-size: 20px;
}

Doesn't align in the centre

Thank you.




Aucun commentaire:

Enregistrer un commentaire