CSS CSS Tutorial CSS Advanced CSS Responsive Web Design(RWD) CSS Grid CSS Properties Sass Tutorial Sass Functions



border-inline-width

CSS (Cascading Style Sheets) is a style sheet language used for describing the presentation of a document written in HTML (Hypertext Markup Language). CSS provides a wide range of properties to style the HTML elements. One of the properties is the border-inline-width property.

Brief Explanation of Border-Inline-Width

The border-inline-width property is used to set the width of the inline borders of an element. The inline borders are the borders that run along the inline content of an element. The inline content is the content that flows within the text of a paragraph or a heading. The border-inline-width property can be used to set the width of the top, bottom, left, and right inline borders of an element.

The border-inline-width property can take the following values:

  • thin: sets the width of the inline border to a thin value
  • medium: sets the width of the inline border to a medium value
  • thick: sets the width of the inline border to a thick value
  • length: sets the width of the inline border to a specific length value (in pixels, ems, rems, etc.)
  • initial: sets the width of the inline border to its default value
  • inherit: inherits the width of the inline border from its parent element

Code Examples

Let's take a look at some code examples to understand the usage of the border-inline-width property:

Example 1: Setting the width of all inline borders

In this example, we will set the width of all the inline borders of a paragraph element to 2 pixels:

  
    <p style="border-inline-width: 2px;">
      This is a paragraph with a 2-pixel inline border.
    </p>
  

Example 2: Setting the width of specific inline borders

In this example, we will set the width of the top and bottom inline borders of a paragraph element to 2 pixels, and the width of the left and right inline borders to 4 pixels:

  
    <p style="border-inline-width: 2px 4px;">
      This is a paragraph with a 2-pixel top and bottom inline border, and a 4-pixel left and right inline border.
    </p>
  

Example 3: Using length values

In this example, we will set the width of the top and bottom inline borders of a paragraph element to 10 pixels, and the width of the left and right inline borders to 20 pixels:

  
    <p style="border-inline-width: 10px 20px;">
      This is a paragraph with a 10-pixel top and bottom inline border, and a 20-pixel left and right inline border.
    </p>
  

Example 4: Using initial value

In this example, we will set the width of the inline borders of a paragraph element to its default value:

  
    <p style="border-inline-width: initial;">
      This is a paragraph with the default inline border width.
    </p>
  

Example 5: Using inherit value

In this example, we will inherit the width of the inline borders of a paragraph element from its parent element:

  
    <div style="border-inline-width: 2px;">
      <p style="border-inline-width: inherit;">
        This is a paragraph with the same inline border width as its parent element.
      </p>
    </div>
  

Conclusion

The border-inline-width property is a useful property in CSS for setting the width of the inline borders of an element. It provides a wide range of values to set the width of the inline borders, including length values, thin, medium, and thick values, as well as the initial and inherit values. By using the border-inline-width property, we can add visual interest to our HTML elements and make them stand out.

References

Activity