What is Cascading Style Sheets: 5 Useful CSS Shorthand Properties

What is CSS (Cascading Style Sheets)?

CSS stands for cascading style sheets. A cascading style sheet is a way to define how HTML elements should look. You can use CSS to change the color of text, add borders, create drop shadows, and much more. This is a style sheets language that allows web designers to create style sheets, and change the look of their websites without having to edit HTML code.

CSS has become essential to modern web design. The ability to customize our sites is now almost limitless. In addition, CSS is also widely supported across browsers and devices.

CSS is now widely used across the web. It has become essential to create beautiful websites. If you want to learn more about CSS, read our guide on How to Use CSS.

In this post, we are now checking the most useful and commonly used CSS Shorthand Properties which will help us in our productivity. 

Cascading Style Sheets: 5 Useful CSS Shorthand Properties
Cascading Style Sheets: 5 Useful CSS Shorthand Properties



Shorthand properties are CSS properties that permit you to set the values of multiple other CSS properties simultaneously. using a shorthand property, you'll write more concise (and often more readable) style sheets, saving time and energy.

The CSS specification defines shorthand properties to group the definition of common properties working on the same theme. as an example, the CSS background property may be a shorthand property that's able to define the values of background-color, background-image, background-repeat, and background-position. 

Similarly, the foremost common font-related properties can be defined using the shorthand font, and therefore the different margins around a box can be defined using the margin shorthand. 

There are hundreds of CSS properties that allow us to modify the look and feel of a page. Some of them are very basic, such as font size or color, while others are more complex, such as border-radius or background gradient.

These are the highest 5 Useful CSS Shorthand Properties

Shorthand Property for FONTS

Before:
 font-style: italic;
 font-weight: bold;
 font-size: 18px;
 font-family: 'Bree Serif', serif; 

After:
  font: italic bold 18px Bree Serif, sans-serif; 

Shorthand Property for BACKGROUND

Before:
 background-color: white;
 background-image: url(images/background.jpg);
 background-repeat: no-repeat;
 background-position: top right; 

After:
 background: white url(images/background.jpg) no-repeat top right; 

Shorthand Property for MARGIN

Before:
 margin-top: 10px;
 margin-right: 4px
 margin-bottom: 10px;
 margin-left: 4px; 

After:
 margin: 10px 4px 10px 4px; 

Shorthand Property for LIST

Before:
 list-style-type: circle;
 list-style-position: inside;
 list-style-image: url(pointer.jpg);
 

After:
 list-style: circle inside url(pointer.jpg); 

Shorthand Property for BORDER

Before:
 border-width: 1px;
  border-style: solid;
  border-color: gray; 

After:
 border: 1px solid gray; 

There are certain things you should know before creating your first markup. In a nutshell, here are the essential differences between HTML and CSS. 


What is the difference between HTML and CSS?

HTML stands for Hypertext Markup Language (markup language). CSS is Cascading Style Sheets (stylesheet). 

HTML stands for Hyper Text Markup Language. This is the language used to create web pages. HTML code has two main parts: tags (which define formatting or structure) and attributes (which provide additional information). 

The other part of HTML is CSS, which stands for Cascading Style Sheets. CSS is a special language designed to style and control the look and appearance of web pages.

HTML has evolved over time, and now has several dialects such as XHTML, HTML5, Microdata, etc. Each format makes some changes to the way HTML works. For example, most browsers support HTML5 but don’t support some older syntax.
 
Both HTML and CSS are web technologies that allow us to create documents with text, images, and other multimedia content. HTML gives us elements to customize our pages, while CSS helps us style these elements.

 
In simple terms, CSS provides the formatting, while HTML contains the code that makes up the page. With CSS alone, we cannot add or remove colors, fonts, etc. For example, we can use CSS to change the background color of an entire webpage, but we cannot change the font size without using HTML tags.

Hope you find this post Useful.

Post a Comment

Previous Post Next Post