Coding 2 Flashcards
what is !DOCTYPE html?
its the first thing in a html document, it tells the browser that its html 5
what is the html tag?
it is the root element, meaning all other elements exist within it
what is the head tag?
child of html tag-
it is where we bundle information about our document, link fonts and titles. Not stuff you generally see on the web page
How many different types of elements can be in the head element
7
what is the meta tag?
child of the head tag-
it is a versatile tag. Each instance carries different information about the document such as the character encoding and the pages dimensions
what is charset?
goes with a meta tag-
tells the browser about the character encoding
what is viewport?
goes with a meta tag-
tells the browser about the pages dimensions
what is the title tag?
child of the head tag-
the text that is put here, goes on the browser tab when the web page is opened.
is the title tag required for all HTML documents?
Yes it is.
why is it important for HTML documents to have a title?
Webcrawlers look for this element to help them index the web page correctly which helps with SEO
What is SEO?
Search Engine Optimization
What is the link tag?
child of the head tag –
used to link the html page to other resources like fonts and stylesheets
what is the body tag?
child of the html tag-
this where the main displayable content of the webpage is put
what is the h1 tag?
a first level heading tag. It has default styling which will make it large and bold. There is only one of these on a page.
what is h2 -h6?
lower level heading tags, these also have default styling properties. More than one of these can be used per page
Should we skip lower level heading tags ? h2-h6?
no we should not skip them, just go in order - do not choose the head line tag based on shape or size. These will be adjusted in CSS
what is the importance of header tags?
they help web crawlers know what the page is about, so its also important for SEO
what is the p tag?
child of the body -
used to say that the text put here is a paragraph
what is the ul tag?
it is the unnumbered list tag, it creates a list of bulleted items
what is li tag?
it is a child of ul tag-
it is a listed item under a ul
what is an A tag?
its an anchor tag, which is used to create a clickable link that leads people to other websites or other pages on web page.
what is a div tag?
it is a basic generic container tag, that is used to group content together.
what do we wrap our elements in ?
opening and closing tags
what is the difference between opening and closing tags?
they are identical except for the fact that closing tags have a forward slash infront of the tag name
what is the anchor tag plus the href attribute used for?
it is used for creating a link that either links to another website or another page on the same website
what are shorthand properties?
are CSS properties that let you set the values of multiple other CSS properties simultaneously.
For instance, the CSS BACKGROUND property is a shorthand property that’s able to define the values of background-color, background-image, background-repeat, and background-position
what happens when you use a shorthand property and dont set a specific value?
the value is set to its default value, which means that it overrides previously set values.
FOR EXAMPLE
background-color: red;
background: url(images/bg.gif) no-repeat left top;
will not set the color of the background to red but to background-color’s default, transparent, as the second rule has precedence.
What is background-color’s default value?
transparent
what is the css property ‘border’?
its a shorthand property that sets an elements border
what values does the shorthand property border set?
border-width
border-style
border-border color
Can border be used to set the value for border-image?
no it cannot, it can only reset its value to the default value….which is none
border is best used when?
when you want all four borders to be the same.
what should you use if you want to make the borders different from each other?
you can use the longhand border-width, border-style, and border-color properties, which accept different values for each side
what should you use if you want to focus on one border at a time?
Alternatively, you can target one border at a time with the physical (e.g., border-top )
what is the default value of border?
none
Measurement values for properties when only one measurement is specified effects what?
all four sides
border-width: 2px
all four sides will be 2px
Measurement values for properties when two measurements are specified, effects what?
When 2 values are specified, the first width applies to the top and bottom, the second to the left and right
Measurement values for properties when 3 measurements are specified, effects what?
When three values are specified, the first width applies to the top, the second to the left and right, the third to the bottom.
Measurement values for properties when 4 measurements are specified, effects what?
When four values are specified, the widths apply to the top, right, bottom, and left in that order (clockwise).
when using multiple non measurable values on a border property, does the order matter?
no it doesn’t.
border: solid black 2px thinck;
OR
border: 2px solid black thick;
and it will render the same
what is the padding property?
it is a shorthand property that sets the padding area on all four sides of an element.
it increases the space between the content and the border
What is an elements padding area?
it is the area between its content and its border
can a value for the padding property ever be negative?
no it is not possible
the padding property is shorthand for what?
padding-top, padding-right, padding-bottom, and padding-left.
what are the possible values for padding tag?
either specific length measurements or percentage relative to the width of the containing block.
difference between using the padding on an element and using the padding in the body of a document?
when using padding on an element, it pushes the border out away from the inner content which can be text or a picture or anything,
when using padding on the body, the border itself is considered the content, so as the padding is increased things are pushed towards the center of the page and away from the edges.
so there are two ways to get something off of the edge of the browser page. Adjusting the padding on the element will move just that element. Adjusting the body will effect everything
why is html not considered a full fledged programming language?
because it doesn’t allow logical statements
what are logical statements?
logical statements are when you set up code to behave one way if a statement is true and behave another way if the behavior is not
what are tags used for?
marking off the beginning and usually the end of an element
do all tags have closing tags?
no some tags are closing tags so they do not have closing tags
what is an html element?
a function, a piece of content or a group content represented and sectioned off by tags
what are html attributes?
attributes are used for setting properties on an html element
class and id are attributes that can be used on all html elements except for?
- base
- meta
- head
- param
- title
what element is the href attribute specific to?
a
the anchor element
what do we mean when we say html is about structuring content?
we mean it
1. specifies each and every one of its elements, whether seen by the user or not
- specifies the hierarchical relationship between elements in a document
elements that have the same hierarchical level are called what?
siblings
elements that are one step lower than another element are called what?
children
elements that are one step higher than another element are called what?
parents
elements that are two or more steps lower than another element are called what?
descendants
what goes in the header tag?
the h1 element - which is the most important header on the page. Its what the page is about.
how many h1 should be on a page?
only one
where does the header tag go?
in the body, before the main
where does h2 -h6 go?
in the main section
can we have more than one h2 - h6?
yes as many as you want
should we skip the order of h2 - h6?
no, you shouldn’t jump from h2 - h5
should we chose our headline based on the default styling properties of the h’s?
no you can adjust all of that in css
what is a css reset?
frontend developers often use what is called a CSS reset to zero out default styles and ensure a consistent user experience across browsers.
two ways to make a comment tag
- /* */
2. control + /
what is commenting out code?
intentionally using the comment tag around code to disable it so you can debug it or put it to the side for later
what is semantic html and what does it mean?
when you’re choosing an HTML element to wrap content, you should choose the one that most clearly aligns with the meaning of your content. For instance, if you’re putting a paragraph of content into the body of your HTML page, use a p element (and not, say, a div
what is the max-width/height property?
it sets the maximum width/height of a property.
what does max width over ride?
width
what does overflow: scroll do?
when the content of an element goes outside of the height and width you can use this to create a scroll bar
what overrides max width?
min width
what does min width/height do?
sets the minimum width/height of a property
why is a block like element like a gas?
because it will take up the size of whatever container/parent element it is put in. it stretches as far as it can up down and left and right
how much space does an image take up?
it takes up all the space it can, only being constrained by its natural height and width dimensions
if an image is larger than the div or parent element it is put in what happens?
the image exceeds the div or parent element
what happens when you put a image that larger than the browser window?
it gets a scroll bar
how do we resize an image?
in css, you mage the image the selector and change the width and the height
how do you set up a hyperlink that will open up the destination in a new tab?
(a href=”website.com”target=”_blank”)Name of link(/a)
how do you set up a link that opens up the user’s email client to send an email to a specific address?
(a href=”mailto:address@email.com”)name of link(/a)
how do you set up a link that opens the user’s email client to send an email to a person of the user’s choosing?
(a href=”mailto:”)name of link(/a)
what additional features can you add to the “mailto” href pattern?
you can cc , bcc, add a subject and add text in the body of the email
when adding additional features to “mailto” pattern with a destination email, do you put extra features inside the same quotations as the email? or do you create its own set?
you include it inside the same quotations
a href=”email.com?subject=check out this email”>email us(/a
when you’re adding one additional feature to a mailto pattern, what do you use to set apart the email and the additional feature?
you use a question mark ?
a href=”email.com?subject=check out this email”>email us(/a
when you’re adding two or more additional features to a mailto pattern, what do you use to set apart the email and the additional features?
you use the ? mark for the first one and then &’s for the rest
(a href=”email.com?subject=check out this email&cc=baysauce415@yahoo.com&bcc=halaup16@gmail.com”>email us(/a)
when adding additional features to a mailto pattern, does the whole value share one set of quotations?
yes, they all share one set of quotations
a href=”email.com?subject=check out this email&cc=baysauce415@yahoo.com&bcc=halaup16@gmail.com”>email us(/a
what is a good reason to leave the destination email blank when creating a mailto pattern?
for a share button, when you want the user to share something with their friends or associates
whens a good time to fill the email destination in a mailto pattern?
for contact info or to sign up or subscribe to something
is it possible to add additional features to a mailto pattern that has a blank email destination?
yes of course, just add the ? directly after the mailto pattern - they share one quotation as well
(a href=”mailto:?subject=hey there”)click here(/a)
when creating a href that opening in another window, does the target=”_blank” share the same quotations as the destination web address?
no it doesnt, it gets its own set of quotations, its its own attribute
(a href=”website.com”target=”_blank”)two different attributes(/a)
what is the alt attribute and name two reasons we use it?
it gives text to the image that will display in the even that the image isnt able to display.
also, the text is read aloud by screen readers which is used by visually impaired users
do we need to use an alt attribute everytime we use an image?
yes every single time
what is the video tag?
the video tag allows you add videos to your page, much in the same way you use images.
(video src=”www.videoaddress.mp4”)(/video)
what are some of the common attributes used with the video tag?
autoplay, loop, controls, and muted
how do you add attributes to the video tag?
add one or more of the attribute names before or after the src with no commas or quotes inside of the opening tag
does the video tag need a closing tag?
yes it does
what is a video extension?
it is the part of the url that points to the video source itself
(.mp4, .avi, etc)
what do we know about a url for a video that doesnt have a video extension?
it means that its pointing to the page and not to the video, so in order to add the video to a webpage youre going to have to do a little more digging
what does the attribute target do?
target specifies when a link is clicked where it is opened up
what is the default value for the target attribute on links?
it is “_self”
meaning if you want it to open up in a different window you must set the target attribute and change it manually
what does the value “_self” on the target attribute do?
it opens up the clicked link in the same window being used by the user
what does the value “_blank” on the target attribute do?
it opens the clicked link in a brand new tab
what element are href and target used on ?
(a)
the anchor element
when two or more links are placed by each other not under a ul or ol tag which way do they display?
side by side, horizontally
can h2 be used in a header tag?
yeah provided it is subtext of a present h1 in the same header tag or a h1 header tag already present somewhere on the page.
what does the strong and the b tag do?
its an inline styling element that makes certain part of text bold
what does the em and i tag do ?
its an inline styling element that makes certain parts of the text italicized
what is a footer tag?
a footer tag is the section closest to the bottom, this usually has contact info, copyrights and various links at the end of web page.
where does the footer go?
in the body beneath the main section
what is a ruleset?
one or more rules or declarations that are targeting a particular element or aspect of a webpage
what is a css selector?
a selector, is the element or aspect of the webpage that is being targeted by the declaration block
what are the two parts of the rule set?
selector and declaration box
what is the css declaration box?
is a set of rules or declarations that are set to the selector
what is the css declaration box contained in?
curly brackets
how is a css declaration or a rule constructed?
it is constructed by a property and a value
what is a css property?
a property represents the thing that is being changed about the selector.
body {
background-color: black}
the body is the selector,
background color is the property, the thing of the selector that is being changed
what is a css value?
a value specifies the exact change in the property
can any css value be used with any css property?
no specific values are associated with specific properties
what is the css property name followed by?
a colon
what is the css value followed by?
a semi colon
what is a css universal selector?
it is a selector that applies to everything on the page
how do we render a css universal selector?
*{
}
how do we target a single element type in css?
single element name {
}
how do we target two different css elements?
first element name, second element name {
}
how do we target a class in css?
.class name { }
how do we target an id in css?
#id name { }
Should we target id’s as selectors in css?
Avoid these, its usually better to use a class selector instead
How do we target an element with a class in css?
element name.class name { }
how to target descendents of an element of a particular class?
element name.class name descendent name { }
example:
ul.grocerylist li {
{
all li’’s that are nested under the element classified as grocery list will be targeted.
no matter how deep the li’s are nested they will be targeted
when writing out pixel measurements, can you separate the number from the px marker?
No, there can be no space between the two otherwise it wont render properly
when targeting two elements in css, does there need to be a space after the comma separating the two elements?
there can be no space or just one space, it doesn’t matter as long as the comma is there
are css selectors case sensitive?
yes they are
can you target descendents of a generic element with no class?
yes you can
element descendent name {
}
section li {
}
this will target all li’s in any section regardless of the classification of the sections
when a browser reads CSS it reads from which way?
it reads from right to left - so the more specific selectors are rendered first and more likely to override ones on the same element that are less specific
how do you target direct children of an element?
parent element > child element {
}
can we add multiple combinations of selectors to the same declaration block?
yes, just add a comma in between the different selectors in the rule set
footer > p , section li {
border: 16px solid black;
}
this will target the children paragraph of the footer and it will target any li descendant nested anywhere under any section tag
when creating rule sets, should we use as many selectors as possible?
no we should use the least amount of selectors as possible.
why should we try and use the least amount of selectors as possible when creating rule sets?
because it allows for more flexibility.
for example : we can create a rule set for p.emphasis which would be valid code and get the job done that we want to achieve. But we could also just make a rule set for .emphasis - this would accomplish the same thing.
And if we wanted to put the styling attributes on another element, all we would have to do is create a div for it and classify it as . emphasis and it will automatically take on the new styling properties. This is preferable than having to make a whole new seperate rule set targeting a new specific element
what is a pseudo class?
is used to specify a special state of an element
what is a pseudo element?
is used to stylize a special part of the element
what is a margin?
a margin is the space from the border going outwards - the higher the margin the more space pushed outwards going away from the edge of the border
using padding is mainly used for what?
pushing content off the edge of its own border
what is margin mainly used for?
pushing other content away from itself
when we add numeric values to the border property what increases or decreases?
the thickness of the border only, it doesn’t push or move anything closer or further from it, padding and margin do that
what is text align ?
it dictates how the text is formatted in a space
what are the some common values to know for text align?
left, right, center and justify, justify-all
what does justify mean?
tells the text to fill the entire width of the document so that each line is flush right to the edge, regardless of whether it affects the spacing between words.
it basically makes it into a box, except for the last sentence
what is justify all ?
its the same thing as justify except that the last sentence is also justified, meaning that the adjustments in the spacing may be more severe throughout the document.
what is border radius?
border radius makes the border curve….0 is a straight box, 100 percent is a complete circle, everything else is varying degrees of rounded edges
what is text transform?
specifies how to capitalize an element’s text. It can be used to make text appear in all-uppercase or all-lowercase, or with each word capitalized.
what are some of the main values that go on the text transform property?
capitalize, lowercase, uppercase
what is the difference between uppercase and capitalize?
capitalize, capitalizes every word
uppercase capitalizes every letter
how do we create a pseudo element?
selector/selectors :: pseudo element {
}
how do we create a pseudo class?
selector/selectors: pseudo class {
}
what is ::first-letter ?
is a pseudo element that allows you to put styles on the first letter of the first sentence of a block level element
what should we keep in mind when we use ::first-letter?
That punctuation and special characters used before the first letter will also be stylized
what is :hover?
this pseudo class allows you to stylize what happens when a user interacts with an element with a pointing device, but does not necessarily activate it. It is generally triggered when the user hovers over an element with the cursor (mouse pointer)
what is the link to link an external css file?
(link rel=”stylesheet” type=”text/css” href=”name of file.css”)
where do we put the link to the css style sheet?
in the head
how do we make a css document?
open note pad or text editor, code up css, save as
nameOFdocument.css in all files
how do you link a css page to a html page?
write out stylesheet link and place the name of the css file as the value for the href attribute
how to render the html and css document once linked?
place it in a folder together and open up the html file, it should open up in the web browser rendering the css and html
what should the first page of your website or the html you want to load be saved as?
index.html
the browser looks for this one first.
what is inline styling?
inline styling is when you style directly into the html code itself
why should you avoid inline styling?
because you cant use it on other elements, its a one and done - it only affects that specific line of code that you’re coding.
what is the separations of concerns?
the separation of concerns is the division of using html for coding the structure and using css to code the presentation and not mixing the two
what is internal styling?
internal styling is using a style tag in the html and then coding inside the style element the same way you would in a css file.
why should we avoid using internal styling?
because it only styles that particular page, its not as extensive and flexible in usage like we want
what is a reason that we would want to use internal styling?
to increase page load speed
what is the best way to apply css to your html?
by using external stylesheets - this way you can multiple pages to your html documents and have full control over every aspect of your page
in css, if there are two rule sets targeting a specific selector with conflicting rules how does the browser decide which one to render?
it chooses the rule with the higher specificity
HTML
body
div class=box
p
CSS
body.box p {
green}
.box p {
red}
the paragraph will be green because body.box p is more specific than .box p
when we have conflicting rules what will we have to do to get our rule rendered?
make it more specific, add more div’s if you need to
what to look for when you wrote a rule and its not rendering the way you think it should
- misspellings
- spaces or lack there of
- execution of open/close brackets
- quotations misused
- value not set/initial value being none
- rule with a higher specificity
what are conditions in reference to css?
conditions are the steps that define specificity - the more conditions the higher the specificity.
for example :
body >main div.modal a {
}
this has 5 conditions and has a very high specificity
a{
}
this only has one condition and is of low specificity
the first rule set would override the second rule set
the difference between conditions and selectors?
conditions are part of a selector, conditions specify a selector.
body, footer {
}
these are two separate selectors with one condition each, both of these have low specificity because neither body nor footer are being specified
body > main div.modal a, footer > div.mlb p {
}
these are two selectors with 4/5 conditions each
what is the cascade?
a process browsers follow to determine which CSS values get applied for all the properties on a given element
what trumps the cascade?
specificity
if two rules have the same specificity and are targeting the same element which one gets rendered?
the one lower on the style sheet/or the one that was applied later
What is the first step the browser takes to determine what styles to apply to an element?
- Finds which rules apply to the element
What is the second step the browser takes to determine what styles to apply to an element?
- Takes all the relevant rule sets and sorts them by origin.
What do we mean by “origin of a rule set”?
Inline style vs. internal vs. external
In sorting the origin of a rule set what overrides others?
Inline styling - it overrides external and importance
What is the third step the browser takes to determine what styles to apply to an element?
It takes all the rule sets that
Have the same origin and importance and sorts them by specificity
What is the fourth step the browser takes to determine what styles to apply to an element?
If there are rule sets still conflicting that gave the same origin, importance and specificity ——
Then the browser takes the rule that’s declared last (lower on the style sheet)
What does the keyword !important ? And what does it do?
It allows you to override other rules that might have been declared later in the stylesheet or in a different file.
Typically if you have to use the keyword !important it is an indication of what?
there is something wrong with your style rules
for instance - you make just need to use a more specific selector
what is the basic idea of the box model?
that all elements on a webpage are actually <b>rectangular boxes </b> even if they appear in a different shape or aren’t visible
what are the 5 aspects of an element that make up its total space?
width height padding border margin
what is width?
width is the length of the content area horizontally
what is the content area?
The content area, bounded by the content edge, contains the “real” content of the element, such as text, an image, or a video player.
what is height?
height is the length of the content area vertically
what happens to height and width when box-sizing is set to border box?
both height and width go from defining the content area to the border area
what is the border area?
the area bounded by the border and everything in it
what is the formula to calculating the total space of an element?
width +
2x border +
2x padding +
2x margin =
total space
Is it possible for the width and height of an element to be different than the one explicitly set in our code?
yes, absolutely. when you set a elements width and height, you are only setting the content area, adding padding and borders will all make it larger than what you have explicitly set
how do we get the browser to respect the width and height that we set in our code?
add box-sizing: border-box to the element
what do we do if we want all the elements in our code to have their width and height explicitly?
we use the universal selector
* {
box-sizing:border-box
}
according to the box model, every element on the page is what? and has what 3 things?
is a rectangular box
and has
- a height
- a width
- content
where is the content in an elements rectangular box?
it is in the middle
what is content surrounded by in its rectangular box?
by optional elements such as padding, border and margin
what is the default width of a block element?
it is the length of the page
what is the width of an inline element?
the length of the content
which way do block elements flow?
top to bottom they will be on top of one another vertically
what is the value name for the default of height and width?
auto
what is the default height of an inline element?
the height of the content
inline elements flow which way?
from left to right horizontally on the same line
most of the time what is done with the height of an element?
its left default/undefined
can we apply padding to any html element?
yes, we can
can padding take a negative value?
no it cannot
when you change the background color of the content area what happens to the padding area?
it changes to the same color as the content area
Is margin taken into account when calculating the width and the height of an element?
No it is not, it is considered external space of an element, so we dont consider it apart of the height or the weight.
we do count it towards the elements total space though
is margin every visible?
no its always transparent and takes the background image of the parent element
do inline boxes (text boxes, links, etc) take up 100 percent of the parent element?
no they do not, their height and weight are generally the size of the content
what is a replaced inline element?
it’s an element whose dimensions are set outside of the document and is linked to the page externally.
think images, videos etc.
what is a non replaced inline element?
it is an inline element thats content is not external but entered into the document itself
what tag do we use for a short quote into our html document?
the inline q tag
what tag do we use for a longer quote?
the block element, blockquote
what is the a css reset?
since different browsers have different default settings developers use CSS resets or CSS normalization to ensure a consistent experience across browsers
what is the background-image property and how do we apply it?
it adds background images to a div
background-image: url( image source address);
how do we adjust the size of a background image inside of a div?
we use background-size: and set the numerical value for the size with the width going first and the height following or using percentages or keywords.
how do we make a background image repeat inside of a div?
we use background-repeat: repeat
or we can use :none; to stop it from repeating
what does linear-gradient do?
it sets up a transition that allows the background of an element to go from one color to the next
what is the syntax for a simple linear gradient transition?
background: linear-gradient( color , color);
this will set a transistion from one color to the next, this is no adjustment to direction, or transparency or where colors change or more than one color, or background image. Its the most basic linear gradient application
what does an element need to have specified in it for a linear gradient to work?
a height