Continued from Web programming 1 Html.
The style contains instructions on how the different elements in a page should look on the screen. The browsers do their best to interpret this and paint the elements. For instance, black on white is soo boring, especially if you want to create cool websites, so let's make the background black - that's what the second part if for, we use the CSS for styling:
|
Oops - you can't see a thing can you? You have to realize that computers are pretty silly and only do exactly what we tell them to. This one forgot to change the color of the text, which is now painted black on black...
In the example above, press Run to have it run and the box to the right will turn black, yet it will contain some hidden text. To reveal the text, here's the hack: place the mouse inside the box, towards the bottom-right corner. Then press the left button and, while holding it down, drag the mouse towards the top-left corner, to select all the contents of the box.
This will reveal the hidden text. Congratulations - you're a hacker!
Let's fix that, by adding color:yellow;
to change the text color:
|
Ok - now we're talking! Let's throw some more elements at that page, in the next lesson.
CSS stands for Cascading Style Sheets - we'll leave the details for later.
Another way to select all content is to click on the box and then press CTRL+A (or the Ctrl and A keys simultaneously) - this works on most browsers.
Continue to Web programming 3 Html content tags.