javascript - How can I keep a text of a div inside it and if bigger, then the div expands down? -
i'd know if there's way keep text inside div if text exceeds width
´div´'s height stretched until text fitted.
update:
thank y'all helping +1, should use ´inherit´ or ´min-height´?
a plain div
:
then added word-wrap: break-word;
, , i've got this:
the ideal:
the div
's height
should increased in order fit whole text
thanks in advance.
div { width: 50px; height: 50px; border: 1px solid red; display: inline-block; word-wrap: break-word; }
<!doctype html> <html> <head> <title>div</title> </head> <body> <div>asjdkljaddddsadsssssssdfsdfsdfsf</div> </body> </html>
change height
min-height
in css:
the min-height
property used set minimum height of element.
this prevents value of height property becoming smaller min-height
.
div { width: 50px; min-height: 50px; border: 1px solid red; display: inline-block; word-wrap: break-word; }
<!doctype html> <html> <head> <title>div</title> </head> <body> <div>asjdkljaddddsadsssssssdfsdfsdfsf</div> </body> </html>
Comments
Post a Comment