
previous

page 27
next
The <style> Tag
Just like JavaScript, it's better to keep our CSS separate. Here's how:
<style>
body {
background-color:green;
}
</style>
<body>
<img src='cards/back.png'>
<img src='cards/back.png'>
</body>
body {
background-color:green;
}
</style>
<body>
<img src='cards/back.png'>
<img src='cards/back.png'>
</body>
Very similar to JavaScript but different enough to cause many headaches!
Now we can centre the cards but we need to group them together and then centre the group.
To do this we need the <div> tag (short for division).
Check this out:
<style>
body {
background-color:green;
}
div {
text-align:center;
}
</style>
<body>
<div>
<img src='cards/back.png'>
<img src='cards/back.png'>
</div>
</body>
body {
background-color:green;
}
div {
text-align:center;
}
</style>
<body>
<div>
<img src='cards/back.png'>
<img src='cards/back.png'>
</div>
</body>
previous
next