How to Add Internal Style Sheets (CSS) to a Web Page

CSS
f t g+ in

It is possible to change the style of a web page with the help of internal style sheets and we will demonstrate how to do that in this tutorial.

Thumbnail Blaster - Video Thumbnail Creation Software

CSS (Cascaded Style Sheet) styles can be added to a web page as internal style sheet as well as an external style sheet. In general, it is good practice to keep all the styling in related external CSS files, e.g. style.css, but in some cases having internal styles may be preferred.

For example, if you want to style a single page and that styling will not be used on any other pages of your website, using internal style sheets makes more sense.

The following example shows how internal styles are added to a web page:

<!DOCTYPE html>
<html>
<head>
  <title>My Web Page</title>
  <style>
  body { background-color: yellow }
  p { margin: 10px }
  </style>

</head>
<body>
  <p>Page content...</p>
</body>
</html>

Please note that all the styling should be done within the opening and closing style tags.

Was this post helpful?

Please consider sharing it, and supporting us with a small tip. Thank you :)

f t g+ in