Search code examples
htmlcssbuttonstylespositioning

How to position a HTML button with link?


<form method="get" action=https://www.wwf.de/spenden-helfen/allgemeine-spende>
    <button type="submit">Spenden </button>

This is my problem the button is just spawning randomly but i need it to be on a spesific place on my website. (Im new with it)

I tried other buttons but i coud not use them as a link. I tried style= in many ways but nothing did work


Solution

  • Its very simple to do this with css.

    Button code example:

    <button class="my-btn">Click here!</button>
    

    Css code:

    .my-btn {
        position: absolute; top: 250px; left: 250px;
    }
    

    This way the button will be placed from 250px at the top left of the page.

    Or simple do a inline code:

    <button style="position: absolute; top: 250px; left: 250px">Click Here!</button>