0

I'm trying to change an element position after grouping with another element but it doesn't work

#Image,#Btn{
    position: absolute;
    top: 50px;
    left: 50px;
}
#Btn{
    right: 50px;
}
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <header class="Head">
            <div>
                <img src="logo.png" alt="logo" id="Image">
                <button id="Btn">Try It Free</button>
            </div>
        </header>
    </body>
</html>
  • Please [edit] your question to include the HTML on which the CSS applies. Also, please explain what you mean by "it doesn't work". I'm pretty sure it's doing exactly what you've programmed it to do :). – Heretic Monkey Sep 04 '19 at 01:15
  • Please share your HTML code. – Foram Trada Sep 04 '19 at 05:40
  • Possible duplicate of [How to remove Left property when position: absolute?](https://stackoverflow.com/questions/10245729/how-to-remove-left-property-when-position-absolute) – Heretic Monkey Sep 04 '19 at 13:23

1 Answers1

0

You should set left: auto if you want to use right: 50px;

#Btn{
    right: 50px;
    left:auto;
}