Basic CSS Properties

Basic CSS Properties

In blog, it shows CSS Properties provided from the posted activity that I have used to create a static non functional(yet) Color Game.

First we need to understand basic understanding before we continue.

CSS (Cascading Style Sheets) is a language used to style and format the appearance of HTML elements on a web page. It controls layout, colors, fonts, spacing, and other visual aspects, allowing you to separate content from design for cleaner code and easier maintenance.

Key Features:

  1. Selectors: Target HTML elements (e.g., p, h1) to apply styles.

  2. Properties: Define the style attributes (e.g., color, font-size).

  3. Cascading: Styles are applied based on rules of specificity, importance, and source order, with the ability to override previous styles.

Now that we have a minimal information we can proceed.

Here is the code snippets:

colorGame.html

 <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Color Game</title>
</head>
<body>
    <br>
    <h1>Color Game</h1>
    <div class="MainBox">
        <div>
            <div class="colorBox1"></div>
            <div class="colorBox2"></div>  
            <div class="colorBox3"></div>
        </div>
        <div>
            <div class="colorBox4"></div>
            <div class="colorBox5"></div>  
            <div class="colorBox6"></div>
        </div>
    </div>
</body>
</html>

Here’s the code snippets for the CSS properties that I used to design the webpage.

style.css

*{
    margin: 0;
    padding: 0;
}
h1{
    margin-left: 565px;
}


.MainBox{
    width: 40%;
    height: 450px;
    margin: 0 auto;
    margin-top: 30px;
    padding: 20px;
    border: 5px solid rgb(255, 194, 194);
    border-radius: 5px;
    display:flex;
    background-color: antiquewhite;
}

.MainBox .colorBox1{
    border: 1px solid rgb(0, 0, 0);
    height: 140px;
    margin: 8px;
    width: 240px;
    border-radius: 5px;
    background-color: aqua;
}
.MainBox .colorBox2{
    border: 1px solid rgb(0, 0, 0);
    height: 140px;
    margin: 8px;
    width: 240px;
    border-radius: 5px;
    background-color: yellow;
}
.MainBox .colorBox3{
    border: 1px solid rgb(0, 0, 0);
    height: 140px;
    margin: 8px;
    width: 240px;
    border-radius: 5px;
    background-color: red;
}

.MainBox .colorBox4{
    border: 1px solid rgb(0, 0, 0);
    height: 140px;
    margin: 8px;
    width: 240px;
    border-radius: 5px;
    background-color: rgb(0, 255, 60);
}

.MainBox .colorBox5{
    border: 1px solid rgb(0, 0, 0);
    height: 140px;
    margin: 8px;
    width: 240px;
    border-radius: 5px;
    background-color: rgb(255, 141, 33);
}

.MainBox .colorBox6{
    border: 1px solid rgb(0, 0, 0);
    height: 140px;
    margin: 8px;
    width: 240px;
    border-radius: 5px;
    background-color: rgb(13, 0, 189);
}

And here is the result of this code.

GitHub Link: https://github.com/rodney-lqr/BasicHTML