Reputation: 1547
I am just curious whether it is possible for a HTML control (e.g: a table) to have larger width than its parent(e.g. a div) and the inner control is entirely visible? Thanks
Upvotes: 0
Views: 1810
Reputation: 32949
It is absolutely possible. you can set the overflow
css property of the parent
element to visible
as follows.
.parent {
# Other Properties
overflow : visible;
}
Now in this case if the width of a child element is more than the width of its parent it will be visible. overflow
would work for both height and width. To make only the heigth or width visible you can use the overflow-x
and overflow-y
property (names are based on x-axis and y-axis).
NOTE: As @cimmanon said the default value of the overflow
property is set to visible
so you may not need to set it explicitly as above. Though, My personal preference would be to set it explicitly in case i want to be sure of it.
Upvotes: 3
Reputation: 68319
A child's dimensions adapt to its parent element when the child's width
is set to a percentage or auto and position
is set to static or relative. So, if you want it to be larger, you can do the following things:
As long as you aren't changing the ancestor elements to have an overflow that hides things (hidden), the descendants will show through.
Upvotes: 1