Help me understand div tags

Tell us what’s happening:

Hello, I am not having trouble with this challenge, rather I am confused about the format of the code provided and just wanted clarification. Towards the end with the lines of code with the div tags, why is there a closing /div tag after /p, and why not just put it with the rest of the closing tags at the bottom? I even adjusted it to make it look like that and it made no visual changes. Am I missing something?

Your code so far


<style>
  h4 {
    text-align: center;
    
  }
  p {
    text-align: justify;
  }
  .links {
    margin-right: 20px;
    text-align: left;
  }
  .fullCard {
    width: 245px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin: 10px 5px;
    padding: 4px;
  }
  .cardContent {
    padding: 10px;
  }
</style>
<div class="fullCard">
  <div class="cardContent">
    <div class="cardText">
      <h4>Google</h4>
      <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University.</p>
    </div>
    <div class="cardLinks">
      <a href="https://en.wikipedia.org/wiki/Larry_Page" target="_blank" class="links">Larry Page</a>
      <a href="https://en.wikipedia.org/wiki/Sergey_Brin" target="_blank" class="links">Sergey Brin</a>
    </div>
  </div>
</div>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/responsive-web-design/applied-visual-design/adjust-the-height-of-an-element-using-the-height-property

<div> tag defines a division or a section in an HTML document.

<div class="cardText">
      <h4>Google</h4>
      <p>Google was founded by Larry Page and Sergey Brin while they were Ph.D. students at Stanford University</p>
</div>

cardText is section of this document . section has start and end when you want to close section need to use </div>

1 Like

i think i get it. it makes a lot more sense when i read the class names. i.e. class is named “cardText” because it covers the section with the header and paragraph.

1 Like
> Hopefully the following helps. 
> <Fullcard open>
>     <Cardcontent open>
>         <Cardtext open>
>              h4open h4 close,
>              pOpen p close
>         <Cardtext close>
>         <Cardlinks open>
>             Anchor links
>         <Cardlinks close>
>      <Cardcontent close>
> <Fullcard close>
1 Like

this was my assumption. thank you!

Is a container, block, or group of content if between opening div tag and closing div tag is related. (class, id, paragraph, heading, link, list, table, etc.)

The “cardText” class is not declared anywhere in the style section. How is it being used in the line:

?

You’re right, the ‘cardText’ is not declared, therefore it does not have any effect on style of that element.
Try to delete it and see that nothing changes.
It is there from previous or for next lessons I assume.

You can declare it in the style section and make it look as you like… :slightly_smiling_face: