Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Semrush - keyword research tool

Turn ChatGPT, Claude, Gemini, And CoPilot Into Your Personal Assistant, Business Coach, Content Creator, And More

AFFILIATE MARKETING Your all-in-one performance engine Manage affiliates, creators, and customer referrals in one unified platform—turning every partnership into measurable growth
Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

42,849 questions

55,678 answers

573 users

How to wrap a text using CSS and HTML

1 Answer

0 votes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Wrapping Example</title>
<style>
    /* Container styling */
    .wrapper {
        width: 300px;               /* Fixed width to demonstrate wrapping */
        border: 2px solid #333;     /* Border for visibility */
        padding: 10px;
        font-family: Arial, sans-serif;
        
        /* Enable wrapping for long words */
        word-wrap: break-word;      /* Older property */
        overflow-wrap: break-word;  /* Modern property */
        white-space: normal;        /* Allow normal wrapping */
    }
</style>
</head>
<body>

<h2>Text Wrapping Demo</h2>

<div class="wrapper">
    This text will wrap automatically when it reaches the edge of the container.
</div>

<br>

<div class="wrapper">
    ThisIsATextWithoutSpacesThatWillBreakAndWrapToTheNextLineUsingCSS.
</div>

</body>
</html>


<!--
run:

This text will wrap automatically when it 
reaches the edge of the container.

ThisIsATextWithoutSpacesThatWillBreakA
ndWrapToTheNextLineUsingCSS.

-->

 



answered Dec 3, 2025 by avibootz

Related questions

1 answer 354 views
1 answer 244 views
244 views asked Jul 14, 2016 by avibootz
1 answer 291 views
2 answers 386 views
386 views asked Jul 16, 2016 by avibootz
1 answer 694 views
...