Categories: Css

3 ways to add CSS to your web sites

Share

Website can not be completed without any style. So you apply CSS. When a browser reads a CSS style sheet, this formats the HTML document according to the information in the CSS style sheet.

With 3 basic ways you can add CSS in your web pages:-

1) Link your webpage with an external file:

<link href="style.css" rel="stylesheet" type="text/css">

or import CSS:

 <style type="text/css" media="all">
 @import "../style.css";
 </style>

Read Also: Align text vertically next to an image

2) Put the css between the <head> tags:

 <!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 <title>Sample page</title>
 <style type="text/css">
 div { padding-top: 10px; }
 </style>
 </head>
 <body>
 </body>
 </html>

3) add CSS using inline:

 <div style="padding-top:10px;">Your content goes here...</div>

View Comments

  • Thanks, this is very useful, basically the import.
    I am new to CSS. Keep posting others.

Recent Posts

Unlock Growth – Guide to Online Financing and Business Loans for Entrepreneurs

If you are in a financial crisis , or need to start a new business…

6 hours ago

Optimize Your Hormonal Balance: Enclomiphene Citrate for Enhanced Wellness

Hormonal balance plays a pivotal role in overall well-being, influencing various aspects of health, from…

1 day ago

Paul Kanes Explores the World of Canine Companionship through Dog Walking

Dog walking is an excellent way to maintain your furry friend's camaraderie and provides many…

1 day ago

Top 5 Must-Have Features Every Mobile App Needs to Succeed

Introduction Businesses understand the diverse requirements of mobile applications, which provide a competitive advantage. There…

1 day ago

IoT Data Analytics: Ways to Gain Value from IoT Data

The Internet of Things (IoT) has recently changed the world. It links gadgets together and…

1 day ago

The Rise of NFTs: Exploring the Impact of Non-Fungible Tokens on the Digital Economy

NFTs, or Non-Fungible Tokens, are revolutionizing the digital economy. These unique digital assets, authenticated through…

2 days ago