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:

plain

then added word-wrap: break-word;, , i've got this:

barely solved

the ideal:

stretched up

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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -