When creating properties such as width, use "%" rather than "px", "pt", "em" or some constant size.
For example, it #element: width:80%;will make an “element” equal to 80% of the width of its parent element. And if the parent element is the body, it will automatically change its width along with the width of the browser window.
If any child element of the "element" has a constant width, the minimum width of the "element" will be the same size as this child.
Hope my answer was helpful.
source
share