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



inset-block

CSS (Cascading Style Sheets) is a style sheet language used for describing the presentation of a document written in HTML (Hypertext Markup Language). CSS is used to style web pages and make them look visually appealing. One of the CSS properties that can be used to style web pages is the inset-block property.

Brief Explanation of Inset-Block

The inset-block property is used to add an inset border to an element. An inset border is a border that appears to be carved into the page, giving the element a 3D effect. The inset-block property is a shorthand property that combines the following properties:

  • border-top-style
  • border-right-style
  • border-bottom-style
  • border-left-style
  • border-top-width
  • border-right-width
  • border-bottom-width
  • border-left-width
  • border-top-color
  • border-right-color
  • border-bottom-color
  • border-left-color

The inset-block property can be used with any HTML element that has a border. The property can be set to a single value, which will apply the same inset border to all sides of the element, or it can be set to four values, which will apply different inset borders to each side of the element.

Code Examples

Here are some code examples of how to use the inset-block property:

Example 1: Single Value

The following code will add a 5px inset border to all sides of the element:

  
    <div style="border: 5px inset black;">
      This is a div with an inset border.
    </div>
  

Example 2: Four Values

The following code will add a 5px inset border to the top and bottom of the element, and a 10px inset border to the left and right of the element:

  
    <div style="border-style: inset; border-width: 5px 10px; border-color: black;">
      This is a div with an inset border.
    </div>
  

Conclusion

The inset-block property is a useful CSS property that can be used to add an inset border to an element. The property is easy to use and can be set to a single value or four values to apply different inset borders to each side of the element. By using the inset-block property, web developers can create visually appealing web pages that stand out from the rest.

References

Activity