# Simple code not working

**URL:** <https://forum.freecodecamp.org/t/simple-code-not-working/175702>\
**Category:** General\
**Created:** [February 20, 2018, 7:46pm UTC](https://forum.freecodecamp.org/t/simple-code-not-working/175702 "2018-02-20T19:46:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrickspolar](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@patrickspolar](https://forum.freecodecamp.org/u/patrickspolar)\
**Post date:** [February 20, 2018, 7:46pm UTC](https://forum.freecodecamp.org/t/simple-code-not-working/175702/1 "2018-02-20T19:46:26Z")

</div>

I’m working on a project on codepen and can’t get my divs to flow how i believe they should. So in order to make sure my understanding is correct i opened a new code and tested the concept. The objective of this code is simple. I will make a block of red with a height of 100 px. then a block of blue with 100px.  
I attempted to complete this by creating a div with a height of 100 and background color red. then i created a second div with a height of 100 and color blue. here’s the html. and below will be the css.

> **[QQmPOj](https://codepen.io/patrickspolar/pen/QQmPOj)**
>
> ...

---

<div class="post-metadata">

**Author:** ![patrickspolar](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@patrickspolar](https://forum.freecodecamp.org/u/patrickspolar)\
**Post date:** [February 20, 2018, 7:51pm UTC](https://forum.freecodecamp.org/t/simple-code-not-working/175702/2 "2018-02-20T19:51:54Z")

</div>

The output only shows the first div to be the size of the row where “asds” is output. I would expect the 2nd div to begin below the first one because they are not nested together. So I’m clearly misunderstanding something. . .

I also understand that i could add something like “magin-top:200px” in the css for dosDiv but i’m more looking for an understanding as to why this isn’t working as is so i could apply that understanding to my actualy project.

---

<div class="post-metadata">

**Author:** ![patrickspolar](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@patrickspolar](https://forum.freecodecamp.org/u/patrickspolar)\
**Post date:** [February 20, 2018, 7:52pm UTC](https://forum.freecodecamp.org/t/simple-code-not-working/175702/4 "2018-02-20T19:52:54Z")

</div>

> **[QQmPOj](https://codepen.io/patrickspolar/pen/QQmPOj)**
>
> ...

  
sorry didn’t realize it was an option hahah

---

<div class="post-metadata">

**Author:** ![camperextraordinaire](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@camperextraordinaire](https://forum.freecodecamp.org/u/camperextraordinaire)\
**Post date:** [February 20, 2018, 8:05pm UTC](https://forum.freecodecamp.org/t/simple-code-not-working/175702/5 "2018-02-20T20:05:02Z")

</div>

I do not see ASDS text anywhere in your current code. Also, you do have them nested together.

See below where I have added comments concerning nesting.

```auto
<div id="unoDiv"> <!-- start of unoDiv div -->
  <div class="row">
    <div class="col-xs-12">
    </div>
  </div>
  <div id="dosDiv"> <!-- dosDiv is nested inside unoDiv here -->
    <div class="row">
      <div class="col-xs-12">
      </div>
    </div>
  <!-- you are missing a closing div for dosDiv -here->
<!-- you are missing a closing div for unoDiv here -->

```

If you want two separate divs, then you would write:

```auto
<div id="unoDiv"> <!-- start of unoDiv div -->
  <div class="row">
    <div class="col-xs-12">
    </div>
  </div>
</div> <!-- end of unoDiv div -->
<div id="dosDiv"> <!-- start of dosDiv -->
  <div class="row">
    <div class="col-xs-12">
    </div>
  </div>
</div> <!-- end of dosDiv div -->

```

This is why it is so important to indent your code to show the various nested elements. Codepen has a Tidy feature on the dropdown of each module (HTML, CSS, JS) which will attempt to make these indentations for you.

---

<div class="post-metadata">

**Author:** ![patrickspolar](https://avatars.discourse-cdn.com/v4/letter/p/7993a0/32.png) [@patrickspolar](https://forum.freecodecamp.org/u/patrickspolar)\
**Post date:** [February 20, 2018, 8:09pm UTC](https://forum.freecodecamp.org/t/simple-code-not-working/175702/6 "2018-02-20T20:09:32Z")

</div>

Surprised I missed something so simple; Thanks for your fast response it is very appreciated. Also, thanks for the tip on the “Tidy” feature. any upvote feature on this forum?

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 8:26pm UTC](https://forum.freecodecamp.org/t/simple-code-not-working/175702/8 "2021-01-17T20:26:25Z")

</div>

Closed on January 17, 2021, 8:26pm UTC


