In this tutorial, you will learn how to change selected text background color in CSS. Whenever you select a text in your browser to copy or just for highlighting purpose, you must have noticed that it always gives you default blue color in the background. To change this color, you can make use of ::selection
It is a very good practice to keep CSS styles in a separate file which is also known as sheet. By doing so, you will have 2 files to work on, one will be HTML and another will be CSS. You only need to add reference to the CSS style sheet using link element. This
By using style attribute which contains multiple properties, will make your code look dirty. In such scenario, Internal Style Sheets help a lot. Internal Style Sheets are created using style element. They are usually placed inside head element. There are multiple selectors like class, ID, tag name etc which you can use to select an
For Inline Styles, we make use of style attribute. You can apply one or more styles directly to an element in HTML. The syntax for a CSS style is given below with an example. property_name:value; <!DOCTYPE html> <html> <head> <title>CSS Tutorials</title> </head> <body> <div style="background-color: red;font-weight: bold;">Hello World!</div> </body> </html>