Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Position not working when specifying Top / Bottom / Left / Right

Specifying a value greater than, or less than zero for top/bottom/left/right has no effect.

Created an id that specifies position: absolute. I can also declare locations but only with zero values i.e. top: 0 or right: 0. Nothing happens though when I specify right:50.

I can't work out why. I've stripped nearly everything out of my document.

Here's the CSS:

#index-content  {
                position:absolute;
                top:349;
                right:0;
                background-color: fuchsia;
                }

Here's the HTML:

<body>
<div id="index-content">The Title</div>
</body>
like image 978
Olly F Avatar asked Dec 21 '25 05:12

Olly F


1 Answers

You should use px or another units, like %, em, pt etc when you set numerical values in css.

like image 164
Roman Pominov Avatar answered Dec 24 '25 09:12

Roman Pominov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!