Is there a way to ensure that text stays inside a div even if it exceeds the width, with the div's height expanding to fit the entire text?
UPDATE:
Thank you all for your help so far. Should I use 'Inherit' or 'min-height'?
A basic div
:
After adding word-wrap: break-word;
, here is the result:
The goal:
The height of the div
should increase to accommodate the entire text.
Appreciate any assistance.
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>