HTML Academy
Applying Decorative Styling to the Line, Step 1
Text Formatting14/26
Back to the list of tasks
  • 1. Unicode Characters
  • 2. The text-shadow Property
  • 3. Horizontal Text Shadow Offset
  • 4. Vertical Text Shadow Offset
  • 5. Text Shadow Feathering
  • 6. The Text Shadow Color
  • 7. Embedded Effect for Text
  • 8. Decorative Retro Shadow
  • 9. Challenge: Psychedelic Shadows
  • 10. Logo: Custom Font
  • 11. Logo: Icon Font
  • 12. Logo: Size Alignment
  • 13. Applying Decorative Styling to the Line, Step 1
  • 14. Applying Decorative Styling to the Line, Step 2
  • 15. The text-indent Property
  • 16. The: first-letter Pseudo Element
  • 17. : first-line Pseudo Element
  • 18. Column Markup: The column-count Property
  • 19. Column Markup: The column-width Property
  • 20. Column Markup: The column-gap Property
  • 21. Text Direction
  • 22. Text Direction and Tables
  • 23. Overflowing Text
  • 24. Spacing Between Words
  • 25. Challenge: Why So Serious?
  • 26. Challenge: Play With Fonts
The text-indent Property
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Applying Decorative Styling to the Line, Step 2

Now we need to change the wrapping rules so that characters that are too wide for the container are wrapped onto a new line.

CSS has the word-wrap property for this. It takes the following values: normal and break-word. In the case of normal, words are wrapped onto a new line in accordance with the usual rules (that is, by spaces). And if the value is break-word, the browser will wrap words at the ends of lines that would otherwise not fit in the container.

This is exactly what we need: We will set the desired word wrapping, increase the inter-character distance, and correct the indentation.

It should also be noted that the word-wrap property was originally a proprietary Microsoft extension, and it has been renamed to overflow-wrap in the current draft CSS specification. The name word-wrap is now designated as an “alternative” name.

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <title>Applying Decorative Styling to the Line, Step 2</title> <meta charset="utf-8"> <link rel="stylesheet" href="style.css"> </head> <body> <div class="square">warmphoto</div> </body> </html>
CSS
@font-face { font-family: "Montserrat Alternates"; src: url("fonts/MontserratAlternates.woff") format("woff"); } body { background: url("rain.jpg") no-repeat 50% 0; color: #333333; font-size: 12px; font-family: "Arial", sans-serif; } .square { margin: 150px auto; width: 260px; border: 5px solid #333333; text-align: center; text-transform: uppercase; font-size: 72px; font-family: "Montserrat Alternates", sans-serif; }

What didn’t you like in this task?

Thanks! We’ll fix everything at once!

The code has changed, click “Refresh” or turn autorun on.

You’ve gone to a different page

Click inside the mini-browser to shift the focus onto this window.

100%
Goalscompleted
0

    Assign the following to the .square block:

    1. the word-wrap rule with the value break-word;
    2. A distance between characters that is equal to 24px;
    3. left padding equal to 24px.

    Cookies ∙ Privacy ∙ License Agreement ∙ About ∙ Contacts ∙ © HTML Academy OÜ, 2019−2025

    VISAMastercard

    Log in

    or

    Forgot your password?

    Sign up

    Sign up

    or
    Log in

    Restore access

    Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.

    Forgot to connect your email to the profile? Email us and we’ll help.