Course Content
Introduction to CSS Part II
Introduction to CSS Part II
Basic Display Properties
The display property in CSS determines how an element should be displayed on the web page. It can be used to control the layout of multiple elements on a page at once and to adjust how an element is displayed in relation to other elements. There are several different values that the display property can take, each of which has a different effect on the element it is applied to.
Here are the different values that the display property can take, along with examples and explanations of how each value works:
inline
This value causes an element to be displayed inline with the surrounding text rather than on its own line.
block
This value causes an element to be displayed on its own line, taking up the full width of its parent element.
inline-block
This value causes an element to be displayed inline with the surrounding text, but it can have its own dimensions (such as width and height). For example
none
This value causes an element to be hidden and not displayed on the page.
flex
This value causes an element to become a flex container, which allows its child elements to be laid out in a flexible and responsive way.
grid
This value causes an element to become a grid container, which allows its child elements to be laid out in a grid pattern.
table
This value causes an element to be displayed as a table with rows and columns.
You can use the display property in combination with other CSS properties and selectors to control the layout and appearance of your web page. For example, you might use the display
property to create a navigation bar that is displayed as a row of inline-block
elements or create a grid
of items displayed as a table
.
Thanks for your feedback!