Part two: HTML and CSS
In this section, you will be looking at a series of exercises to cover the basics of HTML and CSS combined.
- Create from your terminal (in the same folder where your html file is) a file called main.css and import it into your html fileSee the answer
<head> <link rel="stylesheet" type="text/css" href="main.css" /> </head>
- Add some paragraphs to your html file, add some text and then, change the colour of the text all the paragraphs to yellowSee the answer
p { color: yellow; }
- Change now only the colour of your first paragraph to greenSee the answer
p:first-child { color: green; }
- Add three red divs, same height, same width and vertically stackedSee the answer
div { height: 50px; width: 50px; }
- Now, display the three divs on the same row rather than vertically stackedSee the answer
div { display: inline-block; }