Sitemap
D

D

An aspiring Robotics Researcher. I am currently in my 4th year of undergraduate studies. I am working on optimising the ROS navigation packages. Follow 4 more!

Member-only story

Understanding position in css

4 min readJan 27, 2024

As the convention goes there are 4 main values to be used for the position parameter in css. They are static, fixed, absolute, and relative. Let’s first start off with a bunch of divs and proceed from there:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div style="border: 2px solid blue;">
<div style="border: 2px solid black; height: 80px; width: 80px;">
First Box
</div>
<div style="border: 2px solid black; height: 80px; width: 80px;">
Second Box
</div>
<div style="border: 2px solid black; height: 80px; width: 80px;">
Third Box
</div>
</div>
</body>
</html>

This should create 3 boxes within a larger div

Press enter or click to view image in full size
3 divs

Static

Static is pretty much the default. Using static is no different to leaving the position parameter blank in css. Try chaning the position of the divs to static and have a look, they remain exactly the same

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div style="border: 2px solid blue;">
<div…

--

--

D
D

Written by D

An aspiring Robotics Researcher. I am currently in my 4th year of undergraduate studies. I am working on optimising the ROS navigation packages. Follow 4 more!