CSS: Default Value for Height
Question by Compi | 2016-02-16 at 17:56
I have a DIV container to which I have applied a fixed width using the property "height" in an external stylesheet file.
However, there is one HTML page on which I would like to replace this fixed height with the default height of a standard DIV. That means, although I have defined a fixed height within my stylesheet, I would like to read that height via inline CSS for a specific element so that the height is adjusting dynamically to the content as usual.
How can I do that? Sure, it would be easy when we would talk about the width - then I could just overwrite with 100% - but we are talking about the height and here that is not possible. Does someone have any idea?
Related Topics
CSS: Include CSS Stylesheets in HTML
Tutorial | 0 Comments
Website Performance: Deliver JavaScript and CSS files compressed to reduce loading times
Tutorial | 0 Comments
jQuery: CSS Stylesheet Switcher
Tutorial | 1 Comment
Reload Images, CSS, JS and Web Pages despite Browser Cache
Tip | 2 Comments
Darken Background of a Website (Gray Out Effect)
Tutorial | 0 Comments
HTML: Preassign HTML Form with Data
Tutorial | 0 Comments
Mouseover buttons using CSS without reloading
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
The default value for height is "auto".
So, you just have to overwrite the height with "height:auto" for the corresponding elements.
CSS:
HTML:
The first DIV in the example has a fixed height of 100 pixels. The second is reset to the default behavior with "height:auto" so that the height fits the content.
2016-02-18 at 17:46