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>
- HTML5 HELLO WORLD Example
- All directional arrows codes for HTML
- Adding Sub Headings to Bootstrap Header tags
- Create HTML button that looks like a href hyperlink
- 70+ HTTP Error Codes CheatSheet
- Comprehensive 256 Ascii code table with Html Hex IBM Microsoft Key
- How to set background color in HTML page?
- Obsolete marquee element alternatives html5
- Base 64 Index, Character and Binary Table
- Get HTML table td, tr or th inner content value with id or name attribute
- Align html element at the center of page vertically and horizontally
- How to add multiple spaces between html page text
- The author stylesheet specified in tag script is too long - document contains 21759 bytes whereas the limit is 10000 bytes
- How to pretty print HTML using Java Code
- W3 HTML validator warning Unable to Determine Parse Mode
- Hyperlink in html (anchor tag) without a underline
- reCaptcha Verification expired. Check the checkbox again
- Auto Refresh Webpage after every x Second or Minute using Meta Tag?
- Chessboard with pieces using pure HTML and CSS
- Default speed of Marquee tag : SCROLLAMOUNT
- Fibonacci series from 1 to 500 table
- 9 Border to DIV Element in HTML Examples
- How to remove old 404 pages ulrs from Google crawler
- How to make a div tag clickable
- Fix: bash: 127: command not found - Bash
- List of Eclipse versions and future releases (2022-06) - Eclipse
- How to convert an int to a string in Python - Python
- How to create volume in Docker using Command - Docker
- How to change Android Button Color using xml attribute and programatically using java - Android
- How to read a .mat (MATLAB) file in Python - Python
- How to install curl on Alpine Linux - Linux
- Get Desc of Table using Java JDBC - Java