Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make nested DIV exact same width as parent div

Tags:

css

I have a div nested inside another. The parent div contains the title for a drop down menu. The inner div contains the choices. I have them in different divs so that I can add a scroll to the inner div without it causing the title to scroll. I have borders around both. The inner div looks to be 1px narrower on each of the sides. How do I make the child div exactly the same width as the parent div?


2 Answers

That's what width:inherit; is for.

like image 157
Donnie D'Amato Avatar answered Apr 12 '26 10:04

Donnie D'Amato


What's your code like?

Try this, it should work:

width: 100%;
like image 24
isopach Avatar answered Apr 12 '26 10:04

isopach



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!