Tuesday, May 21, 2024

Background and Border usage in HTML



background&border.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="bg.css">
</head>
<body>
    <h1>Akatsuki</h1>
    <ul>
        <li>Tobi</li>
        <li>Sasori</li>
        <li>hidan</li>
        <li>Kakuzu</li>
        <li>Itachi</li>
        <li>Pain</li>
        <li>kisame</li>
        <li>zetsu</li>
        <li>Konan</li>
        <li>Nagato</li>
        <li>Kabuto</li>
        <li>Orochimaru</li>
        <li>Juzo Biwa</li>
        <li>Sasuke Uchiha</li>
    </ul>
</body>
</html>


bg.css


h1{
background:rgb(255, 80, 80);
border: 5px solid black;
/* The above code is written in short including the values for the width, style, color of the border accoridingly */
}
body{
background: url(https://wallpapers.com/images/featured/underwater-background-oepaymjqd9zy7i7v.jpg);
/* fetching the image for the cover from a google page */
background-size: cover;
}
ul{
color: aliceblue;
}

Output:











Background Properties

  1. background:

    • Shorthand property for setting all background properties in one declaration.
  2. background-color:

    • Sets the background color of an element.
  3. background-image:

    • Sets the background image of an element.
  4. background-repeat:

    • Sets how background images are repeated.
      • Values: repeat, repeat-x, repeat-y, no-repeat, space, round.
  5. background-attachment:

    • Sets whether a background image is fixed or scrolls with the rest of the page.
      • Values: scroll, fixed, local.
  6. background-position:

    • Sets the starting position of a background image.
      • Values: can be defined in length units (px, em, etc.), percentages, or keywords (top, right, bottom, left, center).
  7. background-size:

    • Specifies the size of the background image.
      • Values: auto, cover, contain, length units, percentages.
  8. background-clip:

    • Specifies the painting area of the background.
      • Values: border-box, padding-box, content-box, text.
  9. background-origin:

    • Specifies the positioning area of the background images.
      • Values: border-box, padding-box, content-box.
  10. background-blend-mode:

    • Specifies the blending mode for each background layer.
      • Values: normal, multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity.

Border Properties

  1. border:

    • Shorthand property for setting the border-width, border-style, and border-color.
  2. border-width:

    • Sets the width of the border.
      • Values: thin, medium, thick, length units.
  3. border-style:

    • Sets the style of the border.
      • Values: none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset.
  4. border-color:

    • Sets the color of the border.
  5. border-top:

    • Shorthand property for setting the width, style, and color of the top border.
  6. border-right:

    • Shorthand property for setting the width, style, and color of the right border.
  7. border-bottom:

    • Shorthand property for setting the width, style, and color of the bottom border.
  8. border-left:

    • Shorthand property for setting the width, style, and color of the left border.
  9. border-radius:

    • Sets the radius of the element's corners.
  10. border-top-left-radius:

    • Sets the border-radius for the top-left corner.
  11. border-top-right-radius:

    • Sets the border-radius for the top-right corner.
  12. border-bottom-left-radius:

    • Sets the border-radius for the bottom-left corner.
  13. border-bottom-right-radius:

    • Sets the border-radius for the bottom-right corner.
  14. border-image:

    • Shorthand property for setting all the border-image-* properties.
  15. border-image-source:

    • Specifies the path to the image to be used as a border.
  16. border-image-slice:

    • Specifies how to slice the border image.
  17. border-image-width:

    • Specifies the width of the border image.
  18. border-image-outset:

    • Specifies the amount by which the border image area extends beyond the border box.
  19. border-image-repeat:

    • Specifies whether the border image should be repeated, rounded, or stretched.
  20. border-collapse:

    • Specifies whether table borders should collapse into a single border or be separated.
  21. border-spacing:

    • Specifies the distance between the borders of adjacent cells.

HTML Tags Related to Backgrounds and Borders

  • <style>: Used to define CSS within the HTML document.
  • <div>: Commonly styled with backgrounds and borders.
  • <span>: Commonly styled with backgrounds and borders.
  • <table>, <th>, <tr>, <td>: Table elements can have borders.
  • <img>: Images can have borders and backgrounds.
  • <header>, <nav>, <section>, <article>, <aside>, <footer>: Semantic HTML5 elements often styled with backgrounds and borders.
  • <form>, <input>, <textarea>, <button>, <select>: Form elements can have borders and backgrounds.

By mastering these properties, you can create rich, visually appealing web pages with sophisticated background and border designs.




















No comments:

Post a Comment

HTML Semantics sheet

<article> : Defines independent, self-contained content. <aside>: Contains content that is tangentially related to the content...