Styling / HTML / CCS Flashcards

1
Q

How do you use application.html.erb?

A

Located in /app/views/layouts

sets the styling for your application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

HTML

A

Hyper Text Markup Language - A Markup Language used for describing the structure/layout of web pages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

semantic vs non-semantic tags

A

Semantic tags act teh same as a div (non-semantic tag) but have implied meaning (e.g., , , )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

block vs inline elements

A

Inline takes up as much space as needed, while block takes up the entire width of a page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q
A

The Type Declaration tells our browsers that our application is using HTML5 (this is NOT an html tag, but rather just an instruction for the browser about our HTML version)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
A

signals the beginning of our HTML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
A

signals the beginning of our HTML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
A

contains all the metadata (information about the document)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A

contains all the metadata (information about the document)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
A

the title that will show in the tab of your browser

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
A

An ActionView::Helpers. How we link to external stylesheets, i.e. our CSS.

We want this in the head so it loads first.

We could also style right in our html document with a style tag but DON’T DO THAT. We always want to use ActionView::Helpers when we can.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
A

Another ActionView::Helpers. How we link to our client-side statements (JavaScript).

We could use the html tag, but we prefer the ActionView::Helpers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q
A

Another ActionView::Helpers. How we link to our client-side statements (JavaScript).

We could use the html tag, but we prefer the ActionView::Helpers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
A

Contains ALL the elements of the HTML document that we would like to display.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
A

Where all of our view files get rendered.
This is used in a ‘layout level template’ to help us ‘DRY’ up our HTML.
Now instead of needing to repeat the above in every erb/html file we can simply write the html that we want our body to contain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
A

Where all of our view files get rendered.
This is used in a ‘layout level template’ to help us ‘DRY’ up our HTML.
Now instead of needing to repeat the above in every erb/html file we can simply write the html that we want our body to contain.

17
Q
A

Where all of our view files get rendered.
This is used in a ‘layout level template’ to help us ‘DRY’ up our HTML.
Now instead of needing to repeat the above in every erb/html file we can simply write the html that we want our body to contain.

This means that if there is part of a view we want to render on every page (like a navbar or footer), we can put it in application.html.erb.

18
Q

Non-Semantic Tags

A

Non-Semantic
divs are incredibly common but with the introduction of HTML5, there was a move towards semantic tags.
divs tell us NOTHING about the content of the element.
A good use case for a div might be creating an element on a page like a solid box.

19
Q

attributes

A

We can give our HTML elements attributes. These attributes appear inside the tag itself (in between the angle brackets < >).

<img></img>
The img tag has an attribute of src with a value of ‘https…’

20
Q

class

A

the class attribute is used to identify several related elements

21
Q

id

A

the id attribute is used to identify a single element.

id takes higher priority than class in CSS

Only one element should have a certain id. If two elements have the same id, your page will still display, but it may not work the way you expect.

22
Q

CSS

A

“Cascading Style Sheets”

When we apply a class or an id to an HTML element, we can use CSS to select it and give it a “rule” of how it should be styled.

When more than one rule applies to an HTML element (it might have an id and a class), CSS “cascades” down from the more general rules to the more specific rules. The most specific rule is chosen. An id is the most specific rule.

A common misconception is that “cascading” means that our browser will flow down the CSS file and the last rule will be applied.

There is a way to calculate CSS Specificity. Each rule in CSS (i.e a class or id rule) has a specific value assigned. ids have higher values than classes. The highest number wins for most specific and will correspondingly take precedence in application of style. (nice to know, not a need to know)

23
Q

What are ActionView::Helpers

A

allows us to link to external stylesheets (i.e., our CCS) or to our client statements (javascript)

Within our application.html.erb:
Former:
Latter:

24
Q

Block element

A

An element with a display of block will take up the entire width of the page, no matter how small the content is within the tag.
It will always start on a new line.
p, form, h1 - h6, ul, section and divs are all block elements

Most “User Agent stylesheets” (the default styles the browser applies) reset many elements to block

25
Q

Inline element

A

default value for all HTML tags

link, a, span are all inline by default.
They will only take up as much space as it needs.
It will not start on a new line.
You can set the margin and padding but it will only adjust horizontally. Will ignore any rules for width or height.

26
Q

Inline-Block

A

Will situate itself inline, but can set a width and height.