Advertisement
here2share

HTML bg-image not repeated

Aug 13th, 2016
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.08 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. body {
  6.     background-image: url("http://i.imgur.com/g4bPBbf.jpg");
  7.     background-repeat: no-repeat;
  8.     background-position: right top;
  9.     margin-right: 400px;
  10. }
  11. </style>
  12. </head>
  13. <body>
  14.  
  15. <h1>Hello World!</h1>
  16. <p>
  17. Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing... Hello World... W3School... CSS... Testing...
  18. </p>
  19. <p>W3Schools background no-repeat, set position example.</p>
  20. <p>Now the background image is only shown once, and positioned away from the text.</p>
  21. <p>In this example we have also added a margin on the right side, so the background image will never disturb the text.</p>
  22.  
  23. </body>
  24. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement