The Basics Flashcards

1
Q

What property is used to assign the type (or name) of font to be used in an element?

A

font-family

h1 { font-family: helvetica, sans-serif;}

If the first font is not available the second will be used. helvetica is Mac only.

use “ “ around your font name if there are spaces.

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

How do you use internal CSS?

A

On the page that you want to add the CSS put:

<head
<style h1 { color: red; } </style>
</head>

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

What is the attribute selector and how do you use it?

A

Put this in the .css file or between the <style tags at the top of the page.
h1[draggable] { color:blue; }

If the attribute draggable is set for any h1 element in your .html file, it will be colored blue.

<h1 draggable=”true” Hi</h1>
for example.

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

How do you change the root html font size?

A

<style

html { font-size: 30px; }

</style>

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

What are 4 ways you can size fonts?

A

px - pixel is equal to 1/96th of an inch. 0.26mm

pt - point is equal to 1/72th of an inch. Used in MS Word. 0.35mm

em - 1em is 100% of the parent tag

rem - 1rem is 100% of the root tag of the page.

html { font-size: 30px; } inside the style tag.

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

Where on the web can you go to get fonts?

A

fonts.google.com

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

What is a CSS ID selector and how do you use one?

A

Put this in a .css file
#myID {color: blue; }

the # symbol makes this an ID selector.

<h1 id=”myID” Yippie </h1>

ID selector can only be used once per .html file

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

What are the three ways to add CSS to a webpage?

A

Inline, Internal, and external.

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

What is a CSS class selector and how do you declare and use one?

A

Put this in a .css file.
.myClass { color: blue; }

the “.” at the beginning of myClass makes this a class selector.
Put the following in any .html file
<link rel=”stylesheet” href=”./styles.css”
<h1 class=”myClass” I will be blue.</h1>

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

What is the correct code for creating a class named wrapper in a stylesheet?

A

Put this in a .css file
.wrapper {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
grid-auto-rows: minmax(100px, auto);
}
The “.” makes it a class

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

How do you use inline CSS?

A

<h1 style=”color:Green;” I am green </h1>

This will turn only this h1 green.

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

What is a CSS element selector and how do you use it?

A

Put this in the .css file or between the <style tags at the top of the page.
h1 { color: blue;}
in this code, h1 is the element selector.

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

How do you use internal CSS?

A

on the page that you want to add the CSS put:

<head
<style h1 { color:red; } </style>
</head>

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

How do you use external CSS?

A

Create a page with style.css as the name. Include the following code

h1 { color: red; }

In the web page you want to use the stylesheet put

<link rel=”stylesheet” href=”./style.css”
in between the <head tags
All h1’s on teh page will be red.

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

What are the five selectors you can use in .css files?

A

Element selector h1 { color: blue:}

class selector .myClass { color: blue:}

ID selector #myID { color: blue:}

attribute selector hi[draggable] { color: blue:}

Universal selector * { color: blue:}

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

What are the three properties that determine the spacing of the box model?

A

Margin, padding and border.
These three properties along with width and height. it goes…
margin
border
padding
height + width

17
Q

How do you set the width of your border, margin and padding of a paragraph(or any) element?

A

In the following code, the word border can be replaced with padding or margin.
border: 30px solid black;
can then say… border-top: 0px:
Or.. border-width: 0px 10px 20px 30px;
top, right, bottom, left
Or.. border-width: 0px 20px;
with just two values, the first is top+bottom,
the second is left and right

18
Q

How can you center a div?

A

External CSS
div{
width: 50%;
margin-left: 25%;
}

Internal CSS
<style
div{
width: 50%;
margin-left: 25%;
}

<style>

</style>
19
Q

What are the four categories of importance in css?

A

position, specificity, type, and importance.

position - where on the page is it. If you have p{ color: red;} then later on the same page have p{ color: blue;} the blue will be used

specificity - #id, [attribute], .class then element
<p class=”class” #id=”id” draggable> #id will be used in this case.

type - external, internal, and inline

importance - using the !important key word
p { color: red !important;}

20
Q

What is the order of specificity in a css file? what is that order?

A

id then attribute then class then element is
the order of importance
li { color: blue }
.first-class { color: red; }
li[draggable] { color: black; }
#first-id { color: orange; }

21
Q

When you set the font-family for your <p> tags in a css file, between the <style> tags on your page and in <p style="etc.."> inline to different vaules, which one will get used?</style>

A

inline, internal, then external

22
Q

How can you make sure the a rule will be used no matter where it appears in your website?

A

color: red:
color: green !important;
color: black:

green will be used

23
Q

In what ways can you combine selectors in your css file?

A

group selector, child selector, descendant selector, chaining selectors, combined selectors

h1, h2 {
color: blueviolet;
}

p’s that are only one level down
.box > p {
color: firebrick;
}

all li’s that are inside a box class
.box li {
color: blue;
}

all of the selectors must be present
the element selector must come first
li.done#id {
color: seagreen;
}

combined
ul > p.done {
font-size: 0.5rem;
}

24
Q

What are the 4 ways to position elements on your web page?
Which way is the default positioning?

A

static (default), relative, absolute, and fixed

fixed - the element will be in a fixed position in the browser. If you scroll the page, the element won’t move.

25
Q

When using pesticide in the Chrome browser, how do you hover over an item to see what type of element it is?

A

pressing the ctrl key and hovering the mouse over the item.

26
Q

How do you create a circle from a square?

A

border-radius: 50%;

27
Q

What is the default display property of a <span> element?
What is the default property of most other elements?</span>

A

inline is the default display property of <span>
an inline element does not have its own height and width</span>

display: block; is the default for most elements.

28
Q

What are the 4 most used non responsive display properties used?

A

block, inline, inline-block, and none
inline-block can get bigger and smaller
none will hide an element.
Block is default.

29
Q

What does the float property do?

A

float: left; or right

it will allow things to wrap around another element.

30
Q

What is a @media query?

A
31
Q

What are four ways to make your website responsive to different sizes?

A

Media queries, css grid, css flexbox, and bootstrap