Div position | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Div position

I want to be able to position a div somewhere on my page but in the course here they teach by pixels but the problem is that thats only for my device but all other devices have other pixel amounts so it will be in another place on the screen! Can someone give me a suggestion how to make it so it’s in the same place on all devices?

28th Nov 2019, 4:47 AM
Eli
5 Answers
+ 1
estifanos yeah but lets say I want it on te top right corner what do I do?
28th Nov 2019, 5:27 AM
Eli
+ 1
You can use css top:0; right:0; position:absolute; Search more on google about css positioning.(fixed, absolute, relative, sticky)
28th Nov 2019, 5:37 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
0
you can easily give a percentage like this <div width="50%">
28th Nov 2019, 5:26 AM
estifanos
estifanos - avatar
0
Use this for top right corner Margin-top: -10px; Margin-left : -10px; https://code.sololearn.com/WvJ1L32694of/?ref=app
28th Nov 2019, 5:45 AM
estifanos
estifanos - avatar
0
Position fixed or sticky may work for you and position them with pixels and they will appear at same pixels every device
29th Nov 2019, 4:52 AM
[B.S.] BITTU
[B.S.] BITTU - avatar