There are a couple of things I'm not understanding in the code for the "Create Visual Balance Using the text-align Property"

I think I understand how to complete the challenge just fine. But on each challenge, I am also making sure that I understand what all of the pre-existing code means, and I am running into a few questions.

  1. In the div tag around the hyperlinks, the class “cardLinks” is applied, but I don’t see that class defined anywhere in the code. Deleting class=“cardLinks” from the div tag doesn’t appear to do anything. Is this just extraneous code, or am I missing something?

  2. There are two div tags nested within each other, one with the class “fullCard” and the other with the class “cardContent”. I’m wondering a couple of things about this:
    a) Is there any reason not to just apply both classes to a single div tag and eliminate the second?
    b) I don’t understand why the attributes of the class “cardContent” need to be separated out. Wouldn’t giving “fullCard” a bit more padding accomplish the same thing?

Here is the code as provided before completing the challenge. I’m not sure if there is a better way to include it than just copying and pasting… this is my first time using this forum!

h4 { } p { } .links { margin-right: 20px; } .fullCard { border: 1px solid #ccc; border-radius: 5px; margin: 10px 5px; padding: 4px; } .cardContent { padding: 10px; }
<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>

Hello @amydiddler ,

1- You’re not missing anything. In further chapters you will understand that it is very useful to assign a class to similar items on your page to adjust them.
For example: Try to move your links to the right of your contanier. You need to set the rules for each one of them but if you use a class name you can adjust them with writing a single line of code.

2-
a) .fullcard is useful to move your whole box inside a page and style it. Think that you have 4 boxes in your page. Using class name would help you a lot. Same applies for .cardcontent.

b) You might have a point here. But try adding margin properties to each class to see the difference.
Note: Attributes are in HTML. In CSS those are properties .

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.