skip to Main Content

When I go to browser to see the page it’s showing nothing. Also there is no error.

HTML file name: flag.html

CSS file name: flag.css

.red {
  background: red !important;
}

.blue {
  background-color: blue;
}

.green {
  background-color: green;
}
<div class="red"></div>
<div class="blue"></div>
<div class="green"></div>

2

Answers


  1. I believe the problem is that the div you are defining have no content in it (basically the div is empty)

    So, you can either add content or specify the height and width of the div

    .red {
      background: red !important;
    }
    
    .blue {
      background-color: blue;
    }
    
    .green {
      background-color: green;
    }
    
    div{
    height: 50px;
    width: 50px;
    }
    <div class="red"></div>
    <div class="blue"></div>
    <div class="green"></div>
    Login or Signup to reply.
  2. simply you need to add a height and width to your div tags ,because by default they are just an empty tags with a 0 height and width

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search