How To Run Css File In Chrome

If you are new to web development, you may be wondering how to run a CSS file in Chrome to style your HTML pages. In this tutorial, we will show you how to properly link your CSS file to an HTML file and see your CSS styling in action using Google Chrome.

Step 1: Creating the CSS File

First, you need to create a CSS file that will contain your styles. You can create this file using any text editor, such as Notepad, Sublime Text, or Visual Studio Code. Let’s name your file style.css.

For this tutorial, let’s create a simple CSS rule to change the body background color:

    /* style.css */
    body {
        background-color: lightblue;

Step 2: Creating the HTML File

Now, create an HTML file using your preferred text editor. To keep things organized, let’s name your file index.html.

Add the following basic HTML structure to your file:

        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>CSS Tutorial</title>
        <h1>My First CSS Example</h1>
        <p>This is a simple paragraph.</p>

Step 3: Linking the CSS File to the HTML File

To link your CSS file to your HTML file, you’ll need to add a <link> element inside the <head> section of your HTML file. The <link> element should have the following attributes:

  • rel – specifies the relationship between the HTML file and the linked file, in this case “stylesheet”
  • href – specifies the path to the CSS file (in this example, we assume that the CSS file is in the same folder as the HTML file)
  • type – specifies the type of file being linked, which is “text/css” for CSS files

Add the following code inside the <head> section of your HTML file:

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

Step 4: Open the HTML File in Google Chrome

Now that your CSS file has been linked to your HTML file, you can open your HTML file in Google Chrome to see the CSS styling in action. To do this, simply right-click on your HTML file and select Open with > Google Chrome.

Your HTML page should now display with the background color defined in your CSS file, indicating that the CSS file is running correctly in Chrome.


In this tutorial, we demonstrated how to run a CSS file in Chrome by linking it to an HTML file. By following these steps, you can begin to apply CSS styling to your web pages and view the results in Google Chrome.