What does top:100% does in this code?
Go to solution
Solved by Hairless Monkey,
2 hours ago, shivajikobardan said:top:100% only. What's it doing? I'm not getting it.
top: 100% sets the location to be directly below the parent element.
2 hours ago, shivajikobardan said:with respect to li, .dropdown should be 100% from the top of li is what it probably means
So yes, this is correct, just another way of saying it.
Here's an example:
<!DOCTYPE html>
<html>
<head>
<style>
div.a {
position: relative;
width: 400px;
height: 200px;
border: 1px solid red;
}
div.b {
position: absolute;
top: 100%;
border: 1px solid blue;
}
</style>
</head>
<body>
<h1>The top Property</h1>
<div class="a">This div element has position: relative;
<div class="b">This div element has position: absolute and top:100%.</div>
</div>
</body>
</html>
You can play with this here:
https://www.w3schools.com/cssref/tryit.php?filename=trycss_position_top2

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now