Home » New in CSS 3

New in CSS 3

CSS 3.0

CSS 3.0 is a new version of the CSS specification that adds many new features to improve the overall experience on websites by improving compatibility with other CSS versions.

About CSS 3.0

CSS 3.0 is the latest version of the CSS (Cascading Style Sheet) language, which is used to define style rules for web pages. The major changes introduced in this release are related to the box model, which now has an intrinsic width and height; font-size units; inline-block elements; and text-align property.

CSS 3.0 has been developed to make it easier for developers to work on their projects with less effort. It is easier than ever before to create beautiful designs that load faster on clients’ sites or create applications with great typography that look beautiful across all browsers

The main focus of CSS 3.0 is on performance optimization and seamless cross-browser compatibility, making it a must have for any website development project!

The CSS 3.0 specification is a new major release of the Cascading Style Sheets specifications, which define the rules for how formatting in a document is displayed on a computer screen. It was developed by the World Wide Web Consortium (W3C) and released on June 30, 2011. CSS 3.0 introduces many important features including multiple backgrounds, box shadows, translucent borders, animations and transforms.

New features in CSS 3.0 include:

Multi-column layout in CSS 3.0

The multi-column layout is a new CSS3 feature that has been designed with the intent of spreading content across two or more columns. The columns can be horizontal, vertical, or both – and they can be equally spaced or one can be longer than the other.

// Create Multiple Columns
div {
  column-count: 3;
}

// Gap Between Multiple Columns
div {
  column-gap: 40px;
}

// Style of columns
div {
  column-rule-style: solid;
}

// Width of columns
div {
  column-rule-width: 1px;
}

// Colour of Columns
div {
  column-rule-color: lightblue;
}


Flexible box model in CSS 3.0

One unique feature of CSS is its ability to create different layout models for different screen sizes and devices. There are four types of layout models: fixed, absolute, relative, and flexible. The flexible model enables designers to position their elements on the page according to specific breakpoints or fluidity settings that they want for their design. These settings include min-width, max-width, min-height, max-height, percentage widths and heights for columns and rows along with column wrap/breakpoints

 <div class="flex-container">
  <div>1</div>
  <div>2</div>
  <div>3</div>
</div> 

.flex-container {
  display: flex;
}

New units for defining margins, border widths, and padding

Margins and padding are the space around an object that is not occupied by content. Margins can be defined as the distance from the edge of a page to its text and padding as the depth of the space between two objects. The new units for margin widths, border widths, and padding are called “em” or “em square”.

New shorthand property for layering multiple backgrounds on an element

A new shorthand property for layering multiple backgrounds on an element is being introduced with CSS3. The property can be used to create a textured border around content that is similar to the way drop shadows work on an element.

New font matching features in CSS 3.0

The font-family property is the cornerstone of CSS styling. With CSS 3.0, you can now specify multiple font families within a single declaration, which makes writing CSS even easier than before.

Text transform capabilities for transforming single characters into uppercase or lowercase text or an arbitrary string

The Text Transform component of the Time Tracker allows you to apply four text transforms. The text transform capabilities for transforming single characters into uppercase or lowercase text or an arbitrary string are available in this component of Time Tracker.

Box shadow

The box shadow feature allows you to create shadows on the insides of your boxes. It gives them depth and gives them a 3D perception.

Box shadows are used mostly in design to create depth, enhance content, and make it easier for users of the website to understand what they are looking at.

The box-shadow property is one of the most important features of CSS 3.0, which allows you to create shadows around objects and text. The shadows can be created by either a solid color or by gradients.

CSS 3.0 introduced the box-shadow property which lets you create shadows around objects and text in your page layout. The shadow can be created with a solid color or with a gradient, and it can be horizontal, vertical, or diagonal as well as inset and outset.

div {
    box-shadow: 15px 15px 10px #4286f4;
}

Opacity

There is one opacity feature that has been in CSS 3.0 for awhile now. It’s called rgba(). It was released with the CSS3 Color module in 2012 and was meant to assign colors to an object based on a certain percentage of transparency. If you want to use this feature, make sure it is supported by your browser – if not support is coming soon in most browsers.

The opacity feature in CSS 3.0 is an opacity value that can be set on any CSS property, which allows the element to partially cover the background of its parent element.

The opacity feature in CSS 3.0 mainly helps designers implement more complex designs with background images and gradients. It also helps them ensure that there are no unwanted overlaps between layers of content on different elements, which is essential for web page layout design. The opacity function in CSS 3.0 can help designers create more interactive websites and applications by allowing elements to fade into the background or appear suddenly when clicked or tapped

div {
    opacity: 0.6;
}

Rounded Corners

This feature in CSS 3.0 is a new property that gives us the ability to round corners of an element by adding “-webkit-border-radius” or “border-radius”.

This property is not supported in all browser versions, so you can use it on prefixed browsers like Firefox, Safari and Chrome. There are some other limitations as well, but this tool will help you get around them.

In order to make use of this property, developers will need to add a few lines of code. All they have to do is add the property name and value along with a radius value inside a style tag. The browser will then round all four corners of that element for you automatically.

div {
    border: 3px solid;
    border-radius: 30px;
}

There are various types of applications that can utilize this feature, such as:

– Mobile apps

– UI elements

– Websites

Attribute Selectors

CSS3 introduces a new and more efficient way to write CSS code. With this, we can easily add attributes like hover, active, and focus on the selected elements on the browser.

Attribute Selectors feature in CSS 3.0 is a new easy way to apply styles based on attribute values such as class name, ID name, and @keyframes animation names. This is possible with the help of some specific classes like :hover which has different attributes assigned to it based on what value it has in its class name.

This feature helps in writing CSS code with less complexity and without writing unnecessary codes. Attribute Selectors are useful when you have to style multiple sections of your website that have similar properties but different values in their classes or IDs.

With the new Attribute Selectors in CSS 3.0, designers can create beautiful and responsive designs without having to use complex selectors because the style sheet is less verbose.

Attribute Selectors are a new feature introduced in CSS 3.0 which lets designers use simple attributes to style elements with ease. They are available in modern browsers that support CSS 3.0 or higher, including Chrome, Opera, Safari, Firefox and IE 10+.

For example:< div class = “foo” >< div class = “bar” >< / div >

The default styling for this document is to have the text ‘Hello’ appear red with a yellow background. The attribute selector will focus on highlighting this text by applying these styles: .foo { color : red ; background-color :yellow}.

Web-Safe Fonts

Internet users can now use Web-Safe fonts on the web. This article focuses on the features of Web-Safe Fonts in CSS 3.0 and how they can be implemented. Web-Safe fonts allow for more flexibility on the web, such as high resolution and embedded ligatures, making them ideal for use in responsive designs.

The main feature of Web-Safe fonts is that they are optimized for screen rendering and therefore provide a better look than most other fonts that may not be available on your system or considered safe to use on websites.

Web-Safe Fonts features in CSS 3.0 are designed to help screen reader users. The features are not required by the WCAG 2.0 guidelines, but are still being used by most designers because they are easy to implement and work well for most design projects.

The Web-Safe Fonts features use font-display:none, font-size:0, and font-weight:normal to remove text from a website. They can be used on any type of content including headings, body copy, images etc., and have been tested for over 100 years in a wide range of mediums such as newspapers, books and magazines etc.

Useful tips for CSS 3.0

Use CSS 3.0 as CSS 2.1 and as CSS 3.0 for now, but once the software is updated with the final release of the new specification, it will be mandatory to use it with all browsers

Useful tips:

  • Avoid using inline styles: Use a class or ID to style an element and then use an inline style if needed
  • Test your site in both modern and old browsers
  • Avoid using rgba
  • Don’t forget about prefixes and :before
  • Order lists correctly!
  • Use small fonts for headings and sub-headings
  • Reduce text size on web page for legibility
  • Minimize heavy backgrounds
  • Make use of different line-heights and font-sizes for body text

Related Blogs