0

I am reading through files to learn and understand the way cs50 finance page was created. Here is part of the code from login_form.php:

<div class="form-group">
            <input autocomplete="off" autofocus class="form-control" name="username" placeholder="Username" type="text"/>
        </div>

Please, correct my understanding and help me to understand the following:

1) <div> tag allows to divide code into sections to apply the format, written in the outside css file;

2) a class attribute within tag tells the program to use the same features for this particular class, which is defined elsewhere; if yes, then class="form-group" means that there is some css file with something like:

<style>
    div.form-gourp {
        something: color;
        something: font;
        etc.
    } 
</style>

and there might be a few classes like this with different names and different parameters; and to call a class I need to use:

<div class ="nameofclass">

If the above is correct, then: 1) why the code has a few divisions with the same class name and not only one:

<div class="form-group">
            <input autocomplete="off" autofocus class="form-control" name="username" placeholder="Username" type="text"/>
        </div>
        <div class="form-group">
            <input class="form-control" name="password" placeholder="Password" type="password"/>
        </div>

2) where is the file that defines these div.classes? Thank you very much for your help!

1
  • please, help me on this )
    – Vitale
    Jul 28 '16 at 8:29
1

Consult this section of the pset specs: http://cdn.cs50.net/2015/fall/psets/7/pset7/pset7.html#styles

There are two .css files contained within the pset7/public/css directory that you are free to explore (and modify).

Regarding why it is styled the way it is, my suggestion is this: play around with what happens when certain class names are changed or removed. "Breaking" things and putting them back together, I have found, is an invaluable way to see why it is the way it is.

3
  • thank you for your answer. Yes, I agree with you that playing around with different possibilities is the best way to learn; I was merely hoping to get some clarification on the basics to make sure I understand the difference between div and inputs without divs.
    – Vitale
    Jul 29 '16 at 16:19
  • sorry for getting back with this question but I couldn't find <div classes> in public/css folder. style.css doesn't reveal classes. Thank you! It's so hard for me but extremely interesting, and I feel great when I manage to get to grips with this or that concept )
    – Vitale
    Jul 30 '16 at 12:13
  • This page may be of assistance: w3schools.com/css/css_syntax.asp Search "bootstrap.css" for ".form-group" and you will see CSS designed for that class.
    – Peter
    Jul 30 '16 at 16:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .