1. How Web Pages Work

Every web page you visit is built from two languages that work together. HTML (HyperText Markup Language) describes the content and structure of a page: headings, paragraphs, links, images and forms. CSS (Cascading Style Sheets) describes how that content looks: colours, fonts, spacing and layout. The browser downloads both and draws the page. In MVC, your Razor views are mostly HTML and your CSS files live in wwwroot, so you need both to build real pages.

Key points

  • HTML = the structure and content (the skeleton).
  • CSS = the appearance (the clothes and paint).
  • Both are plain text files that any browser can read.
  • You do not need to install anything to learn: use the editor on this page.

Example: HTML and CSS together

HTML and CSS Open in editor
<h1>Hello, student</h1>
<p>This sentence is HTML. Its colour comes from CSS.</p>

<style>
  h1 { color: black; border-bottom: 3px solid black; }
  p  { color: darkred; font-size: 20px; }
</style>
Show explanation

The h1 and p tags are HTML. The style block holds CSS rules that change how those tags look. Change darkred to blue and press Run.

Try it yourself

Edit the code below and press Run. The result appears in the preview underneath.

Editor
Reset Preview runs in a safe sandbox. Scripts are disabled.
PREVIEW