What is CSSWhat is CSS?CSS stands for Cascading style sheets. It describes to the user how to display HTML elements on the screen in a proper format. CSS is the language that is used to style HTML documents. In simple words, cascading style sheets are a language used to simplify the process of making a webpage. CSS is used to handle some parts of the webpage. With the help of CSS, we can control the colour of text and style of fonts, and we can control the spacing between the paragraph and many more things. CSS is easy to understand but provides strong control on the Html documents.CSS is combined with HTML. Advantages of CSSHere are the following advantages of CSS, such as:
Why do We Use CSS?As we all know, CSS is a powerful style sheet language used to control the HTML document to improve the webpage design.
Example of CSSOutput: Types of CSSThere are three types of CSS: 1. Inline CSSInline CSS is used to style the elements of HTML documents. It is used in HTML to style the attributes without using the selectors. It is challenging to manage the inline function in websites compared to other types. It is very helpful in Html in some situations. Example of inline CSS: 2. Internal CSSInternal CSS is used to design the style single page effectively. It is more time-consuming because we can only work on one page or we need to style each web page. In internal CSS, we style a single webpage uniquely. Syntax: Example of internal CSS: Output: 3. External CSSExternal CSS is used to link all webpage with an external file. CSS, which can be created in a text file. It is more efficient for styling an extensive webpage. It also increases the readability of the CSS files. Syntax: How does CSS Work?As we all know, CSS helps bring style to our webpage by providing different styles to Html documents. For example: With the help of <h1></h1>tags in Html, we can create the header. But CSS makes it more attractive. For example: CSS CommentCSS comment, as the name says, with the help of comments, we can pass the message in our code so the user can easily understand the code. With the help of comments, we can make our source code attractive. For Example: SelectorsIn CSS, selectors select the specific word you want to style. There are different types of selectors:
1. The Element selectorElement selectors are used to provide styling to a selected HTML document. Syntax: Example: 2. The universal selectorWe use an asterisk (*) sign to define the universal selector in the universal selector. It is used to select all the Html documents. For Example: 3. Id selectorIt is the most commonly used operator in CSS. It is used to set the style to a given id. It is denoted by (#). Syntax: Example: 4. The Class SelectorThe class selector is used to select elements that have some class attributes. We use a (.) character with a specific class to select an element. Example: Implementation of all Selectors in CSSCSS ColorsIn CSS, we have different types of colouring schemes. In CSS, we widely use three techniques:
RGB is a combination of three colours red, green, and blue. It takes three parameters, and the value of each parameter varies from 0 to 255. For example: RGB(255,0,0)
Hex is a code that starts with # and comprises 6 numbers which are further divided into 3 groups. It also contains a group of red, green, and blue. It varies from 00 to 09.
RGBA start with 4 parameters. It contains red, green, blue, and alpha. In RGBA, the first 3 parameters vary from 0 to 255, and the last varies from 0 to 1. Implementation of all Colors in CSSCSS backgroundIn CSS, we have different ways by which we can affect HTML documents. There are a few as follows:
CSS BorderIt is used to set up the border for the Html elements. There are some main properties for the setup of the border in Html elements:
We can set the border from right \, top, bottom, and left. For example: border width = 2px, 5px;
Next TopicWhat is CSS
|