HTML Academy
Slicing Asymmetrical Images
Frames and Backgrounds16/33
Back to the list of tasks
  • 1. Preparation
  • 2. Background Size, Step 1
  • 3. Background Size, Step 2
  • 4. Background Borders
  • 5. Background Cropping
  • 6. Multiple Background Images
  • 7. Positioning the background relative to different borders
  • 8. background-repeat: round
  • 9. background-repeat: space
  • 10. Outer Frame
  • 11. Rounding Corners, Part 1
  • 12. Rounding Corners, Part 2
  • 13. Frame Image: border-image-source
  • 14. Frame Image: border-image-slice
  • 15. Slicing Asymmetrical Images
  • 16. Frame Image: border-image-repeat, Part 1
  • 17. Frame Image: border-image-repeat, Part 2
  • 18. Frame Image: border-image-width
  • 19. Frame Image: border-image-outset
  • 20. Muffin’s Royal Frame
  • 21. Muffin’s Eco-Frame
  • 22. Muffin’s Round Frame, Part 1
  • 23. Muffin’s Round Frame, Part 2
  • 24. Challenge: The Sea Wolf
  • 25. Frames and Triangles, Part 1
  • 26. Frames and Triangles, Part 2
  • 27. Frames and Triangles, Part 3
  • 28. Creating an Arrow with a Frame
  • 29. Creating a Round Arrow with a Frame, Part 1
  • 30. Creating a Round Arrow with a Frame, Part 2
  • 31. Real-Life Triangles, Part 1
  • 32. Real-Life Triangles, Part 2
  • 33. Challenge: Jewelry Work
Frame Image: border-image-repeat, Part 2
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

Frame Image: border-image-repeat, Part 1

A diagram of the fillable frame areas when using the border-image-repeat property

The border-image-repeat property specifies how the background of the frame side areas (the green areas in the figure) will be filled.

The property has four values: stretch, repeat, space, and round.

The default value is stretch. When this value is set, the background images are stretched to the full length of the side areas.

If the repeat value is set, background images will be repeated. However, they can be cropped.

You can set the fill mode separately for the horizontal and vertical sides of the frame.

For example:

/ * All borders of the frame are filled in stretch mode * /
border-image-repeat: stretch;

/ * The horizontal borders are filled in repeat mode, and the vertical borders are filled in stretch mode */
border-image-repeat: repeat stretch;

Let’s take a look at what the difference is between these two options.

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <title>Frame Image: border-image-repeat, Part 1</title> <meta charset="utf-8"> <link rel="stylesheet" href="setting.css"> <link rel="stylesheet" href="style.css"> </head> <body> <div class="portrait"></div> </body> </html>
CSS
.portrait { box-sizing: border-box; margin: 50px auto; padding: 10px; width: 270px; height: 270px; outline: 10px solid white; border: 50px solid rgba(0, 0, 0, 0.4); border-image-source: url("img/border-img.png"); border-image-slice: 50; border-image-repeat: stretch; background: url("img/border-img.png") no-repeat center #ffffff; background-clip: padding-box; }

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
    1. Set the border-image-repeat property with a value of stretch repeat for the .portrait block,
    2. then change the block width to 350px
    3. and also change the height to 350px.

    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.