Is there a way in CSS to set the width of any element to equal the width of its parentNode? I tried ‘inherit’ – sounds logic – but it didn’t work.
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This means 100% of the parent element’s width.
Note that it might not work if the element has the display property set to something different to “block”, and in a few other cases.
If you try it on 2 nested divs, it’ll work.