Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in HTML or XML. CSS3 is the latest version of CSS, which includes new features and improvements to the previous versions.
Selectors
In CSS3, there are several new selectors added to the previous versions:
:nth-child()
- selects elements based on their position within a parent element.:nth-last-child()
- selects elements based on their position within a parent element, counting from the end.:nth-of-type()
- selects elements based on their position within a parent element, only counting elements of the same type.:nth-last-of-type()
- selects elements based on their position within a parent element, only counting elements of the same type and counting from the end.:not()
- selects elements that do not match a specific selector.
Box Model
The box model in CSS3 has been updated to include new properties:
box-sizing
- determines how the total width and height of an element is calculated.box-shadow
- adds a shadow effect to an element.border-radius
- rounds the corners of an element.
Media Queries
Media queries in CSS3 allow for responsive design, which means that a website can adapt its layout to different screen sizes and devices. The syntax for media queries has been updated in CSS3 to include new features:
min-width
- sets the minimum width of a device for the styles to apply.max-width
- sets the maximum width of a device for the styles to apply.orientation
- sets the orientation of the device (portrait or landscape).
These are just a few of the new features included in CSS3. With CSS3, web developers can create more dynamic and visually appealing websites.