HTML & CSS Code

Learn to Code Today!

Learn 10x faster: coding, no-code and data skills. Join millions of users mastering new tech skills and accelerating their career with Enki.
Get started

This is part of “An intro to Web” series of posts, with content from the Enki app. If you stumbled upon this, you can start from the beginning.

CSS and HTML are the core languages used for creating web pages and web-based applications.

HTML creates the structure and content of a webpage with text, images, links, and containers, while CSS modifies the design and display of those items in the HTML page.

HTML is made up of content between tags: <tag>Content here</tag>.

CSS is made of selectors followed by a declaration block: selector {declaration block}.

HTML example:

In the HTML example above, we create a heading and paragraph elements.

CSS example:

In the CSS example above, we set the HTML <p> elements content to the color red, and the font size of the <h2> element’s content to 24 pixels.

HTML & CSS in the Browser

HTML and CSS are languages used by browsers to present information to the users.

An HTML web page will display text, images, links, and containers, but has little control over how that content appears.

A CSS document will provide the rules for how the text, images, links, and containers should appear — whether it’s setting text to bold or italic, setting width, height, and position for an image or container. If a .css file is opened in a browser, the browser would just display the CSS code exactly as it is written in a code editor.

Let’s say we have 2 files:

HTML file:

CSS file:

Loading only the HTML file gives the paragraph mentioned above.

Loading both files gives the paragraph mentioned above and colors it green.

However, loading just the CSS file will only show the text p {color: green;}.

About Enki

  • Fully personalized online up-skilling
  • Unlimited AI coaching
  • Designed by Silicon Valley experts

More articles

Meet your AI-enabled coach

Professional athletes have a coach for every aspect of their performance. Why can’t you for your work? Enki’s AI-powered coaching on-demand - combined with state of the art, structured learning content - makes this a reality.
1
1:1 AI Coaching
How do I remove duplicate emails?
Convert the list to a set and back to a list. Sets automatically remove duplicates.
2
Personalized Exercises
3
Interactive practice

Unlock full access to all skills on Enki with a 7-day free trial

Get started