• Home
  • Docker
  • Kubernetes
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • CI
  • Install
  • Samples
  • Archived
HTML | CSS (Cascading Style Sheets)
  1. Defining Styles
    1. External declaration
    2. Internal declaration
  2. Selectors
    1. Matching elements by type
    2. Matching elements by class
    3. Matching elements by identifier
    4. Matching elements by the universal selector
  3. The margin, border, and/or padding properties
    1. Padding style
    2. Border style : width, style, and color
    3. Margin style

  1. Defining Styles
    1. External declaration

      The file "mtitek.style.3.css" may contain some declarations like the following:
    2. Internal declaration
  2. Selectors
    The selectors are patterns that allow the browser to match page elements with their corresponding styles.

    1. Matching elements by type
      The following style:

      Refers to the "p" elements:

    2. Matching elements by class
      • The following style:

        Refers to the "p" elements whose value of the "class" attribute is "class1":

      • The following style:

        Refers to all elements whose value of the "class" attribute is "class2":
    3. Matching elements by identifier
      The following style:

      Refers to all elements whose value of the "id" attribute is "id1":

    4. Matching elements by the universal selector
      The following style:

      Refers to all elements:
  3. The margin, border, and/or padding properties
    HTML elements in a page are contained within a box which can have the padding, border, and/or margin properties.
    • The border define the border-with, border-style, and border-color properties of the element's box.
    • The padding properties define the space between the element's contents and its border.
    • The margin properties define the space between the element's box and the enclosed element box.


    1. Padding style
      You can use padding-top, padding-right, padding-bottom, and/or padding-left to define specific values for each side.


      You can use padding shortcut if you want to define values for all sides; its effect is determined by the number of values provided.
      The padding shortcut define the padding values for all sides in the following order: top, right, bottom, left.

      • One value:
        The padding-top, padding-right, padding-bottom, and padding-left are set to this value.

      • Two values:
        The padding-top and padding-bottom are set to the 1st value.
        The padding-right and padding-left are set to the 2nd value.

      • Three values:
        The padding-top is set to the 1st value.
        The padding-right and padding-left are set to the 2nd value.
        The padding-bottom is set to the 3rd value.

      • Four values:
        The padding-top is set to the 1st value.
        The padding-right is set to the 2nd value.
        The padding-bottom is set to the 3rd value.
        The padding-left is set to the 4th value.
    2. Border style : width, style, and color
      • Border width
        You can use border-top-width, border-right-width, border-bottom-width, and/or border-left-width to define specific values for each side.

        You can use border-width shortcut if you want to define values for all sides; its effect is determined by the number of values provided (see padding shortcut).

      • Border style (possible values: none, dotted, dashed, solid, double, groove, ridge, inset, outset)
        You can use border-top-style, border-right-style, border-bottom-style, and/or border-left-style to define specific values for each side.

        You can use border-style shortcut if you want to define values for all sides; its effect is determined by the number of values provided (see padding shortcut).

      • Border color
        You can use border-top-color, border-right-color, border-bottom-color, and/or border-left-color to define specific values for each side.

        You can use border-color shortcut if you want to define values for all sides; its effect is determined by the number of values provided (see padding shortcut).

      • Border shortcut
        You can use border shortcut if you want to define specific values for each side for the border-width, border-style, and border-color.

        The shortcut has the following syntax: border: < border-width> <border-style> <border-color>;
    3. Margin style
      You can use margin-top, margin-right, margin-bottom, and/or margin-left to define specific values for each side.

      You can use margin shortcut if you want to define values for all sides; its effect is determined by the number of values provided (see padding shortcut).
© 2025  mtitek