Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

HTML , CSS how to fix paragraph inside box only

hello i am new in HTML and CSS now i have a problem with paragraph text it is overlapping i don’t know how to solve this.
here is the picture

enter image description here

here is the code i wrote.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<style>
    .box{
        padding: 10px;
        width: 500px;
        height: 200px;
        border:1px solid red;
    }
</style>
    <div class="box">
        hello hello hello hello hello hello hello hello hello hello hello hello hello hello hellohello hello hello hello hello hello
        hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
    </div>
</body>
</html>

>Solution :

Use word-break: break-word;

Here is a link to learn more

.box {
     padding: 10px;
     width: 500px;
     height: 200px;
     border:1px solid red;
     word-break: break-word;
 }
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div class="box">
        hello hello hello hello hello hello hello hello hello hello hello hello hello hello hellohello hello hello hello hello hello
        hellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohellohello
    </div>
</body>
</html>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading