How to Write CSS Script in Html

Cascading Style Sheets (CSS) is a script that allows html programmer to stylise the html elements. This allows them to customise the page to their liking and adding a greater amount of appeal to it. While it is possible for the programmer to customise the html page without using the CCS page, writing the CSS script on another page and linking it with the main html document simply makes the customisation more convenient. It also allows the programmers to easily make changes in the page if he wishes to later.


  • 1

    The first thing that you need to do is to set up an index page. For this, you will be required to use html language. If you are using a computer or laptop that is running Windows, put the text into Notepad, which is a built-in programme in Microsoft’s operating system. The index page should typically have a title, head and body. The title should have an opening tag, i.e. , followed by whatever the title is before eventually using the html tag. The same needs to be done of head and body using their respective tags.

  • 2

    For the creation of the CSS page, the title needs to end in the suffix “css.”  In order to keep everything simple for now, name the page “My CSS Page.” Use the html tags to create the page. Once you have inserted the necessary tags in the page, the text should read My CSS Page

  • 3

    After you are done creating the CSS page, insert the link of the CSS page within the header of the page that you created in the first page, i.e. the index page. In order to place the link in the index page, you will have to use the appropriate html tag. Considering the CSS page that was created in the second step, the link text should look like

  • 4

    Proceed further by setting up the heading and paragraph for the title page. You can keep any either title you want. The paragraph can be of any length you desire. Remember to use the and tags for the title and paragraph respectively. Do not remember to close the tags either.

  • 5

    You can change the background colour on the CSS page using the CSS language. If you want to set a blue background, the CSS script would look like {background: blue ;}. Replace blue with red or some other colour in the curly brackets if you want to set a different colour.

  • 6

    You can view the page that you just created by clicking “file” in the toolbar from the top-left corner of the Notepad window and then clicking “open file.”

Leave a Reply

Your email address will not be published. Required fields are marked *

six + = 9