If you are using a long word without any break in between then the text might extend beyond the allocated area and push out giving a bad experience to end-users.
Use the word-wrap property and set it to break-word, additionally a fixed-width needs to be specified.
For example, below is some sample text in a Div with a long word without a break. Notice, how it goes outside the allocated area (width = 300px).
This is a Div. I am going to show how a looooooooooooooooooooooooooonggggggggggggggggggggggggg text without any breaks will look like.
Now let us look at the same example, but using the word-wrap property (word-wrap:break-word). Notice how neatly the text is wrapped and aligned.Here is the code (a fixed width is important here) -
<div style="background:lightgray;width:300px;word-wrap:break-word"> This is a Div. I am going to show how a looooooooooooooooooooooooooonggggggggggggggggggggggggg text without any breaks will look like. </div>
- remove div vertical scroll
- Create HTML button that looks like a href hyperlink
- Comprehensive 256 Ascii code table with Html Hex IBM Microsoft Key
- HTML5 HELLO WORLD Example
- Get HTML table td, tr or th inner content value with id or name attribute
- Adding Sub Headings to Bootstrap Header tags
- What is the doctype for HTML5?
- Chessboard with pieces using pure HTML and CSS
- Hyperlink in html (anchor tag) without a underline
- W3 : character data is not allowed here html validation error
- Fibonacci series from 1 to 500 table
- 9 Border to DIV Element in HTML Examples
- How to add multiple spaces between html page text
- How to turn off autocomplete in input fields in HTML Form
- Default speed of Marquee tag : SCROLLAMOUNT
- How to word wrap in HTML
- Force convert HTML text input to upper case
- HTML5 CSS3 Color Codes List
- How to remove old 404 pages ulrs from Google crawler
- reCaptcha Verification expired. Check the checkbox again
- All directional arrows codes for HTML
- Align html element at the center of page vertically and horizontally
- How to make a div tag clickable
- Remove Html head and body tags from ckeditor source
- Auto Refresh Webpage after every x Second or Minute using Meta Tag?
- DDMS files not found hprof-conv.exe - Android
- How to get weather details in Command Prompt, macOS or Linux Terminal - HowTos
- PHP drag and drop file upload tutorial using dropzone.js - PHP
- AADSTS90033: A transient error has occurred. Please try again. [Microsoft 365] - Microsoft
- List of jars required for Struts2 project - Java
- How to run a Maven jar project from eclipse without tomcat - Eclipse
- Step-by-Step: Setting up Docker + Ubuntu Linux + Git + GitHub Tutorial - Git
- Disable Control Scroll Zoom-in and Zoom-out in Notepad++ - NotepadPlusPlus