Knowee
Questions
Features
Study Tools

Step 2 - Floating Elements Inside ContainerCopy the code from the previous stepCreate a container div that includes the 4 squaresCreate a new CSS class for the containerWe have 2 rows and 2 columns, each one with 20 pixels and a border of 1 pixel on each side. This means we need to set the container width and height to 44 pixelsUse the float CSS property to have the divs arrange within the available spaceThe result should look like this:

Question

Step 2 - Floating Elements Inside ContainerCopy the code from the previous stepCreate a container div that includes the 4 squaresCreate a new CSS class for the containerWe have 2 rows and 2 columns, each one with 20 pixels and a border of 1 pixel on each side. This means we need to set the container width and height to 44 pixelsUse the float CSS property to have the divs arrange within the available spaceThe result should look like this:

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Floating Elements Inside Container</title>
    <style>
        .container {
            width: 44px;
            height: 44px;
        }
        .square {
            width: 20px;
            height: 20px;
            border: 1px solid black;
            float: left;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="square"></div>
        <div class="square"></div>
        <div class="square"></div>
        <div class="square"></div>
    </div>
</body>
</html>

This problem has been solved

Similar Questions

Step 1 - 4 Squares with BordersCreate a 2 by 2 grid using 4 divsEach div will represent a squareCreate a class for the square and add it to each div elementAdd CSS properties to the class and set the width and height to 20 pixelsAlso, add CSS properties to the class to add a 1 pixel border to the elementsThe result should look like this:check code

Imagine we have a grid with the following CSS properties, with 4 boxes inside of it. If we added a fifth box to the HTML, what height would it have?.grid {  grid-template-rows: repeat(2, 50px);  grid-template-columns: repeat(2, 100px);  grid-auto-rows: 60px;  grid-auto-columns: 70px;}60px100px50px70px0px

Imagine we have a grid with the following CSS properties, with 4 boxes inside of it. If we added a fifth box to the HTML, what width would it have?.grid {  grid-template-rows: repeat(2, 50px);  grid-template-columns: repeat(2, 100px);  grid-auto-rows: 60px;  grid-auto-columns: 70px;}60px50px100px70px0px

Which value is used to evenly space rows of flex items vertically within a container with no space above the first or below the last elements?

Which CSS property is used to create a flexible container?display: flex;display: block;display: inline;display: grid;

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.