Everything Else Flashcards
Can you set border on an inline element?
Yes
Can you set margin on a block element?
Yes
Can you set margin on inline elements?
Only on the left and right
Can you set padding on a block element?
Yes
Can you set padding on an inline element?
Yes
How do you center a block-level element?
Set an explicit width like width: 500px; and margin: 0 auto; on the element.
How do you center inline content inside of an element?
Set text-align: center; on the container
How do you create a new DOM element of the div type?
document.createElement(‘div’);
Is this an absolute or relative path: /User/ericlewis/Desktop
absolute
Is this an absolute or relative path: unit01/hw
relative
Is this an anonymous or named function?const x = function() {};
An anonymous function
Provided a DOM elementconst image = document.querySelector(‘img’);how would you get the source of the image?
image.getAttribute(‘src’);
Provided a DOM elementconst p = document.querySelector(‘.some-paragraph’);how would you change the paragraph content to the string “hello”?
p.innerHTML = ‘hello’;
Provided the codeconst alertHi = function(evt) { alert(‘hi’) };const button = document.querySelector(‘button’);how would you invoke alertHi whenever the button is clicked?
button.addEventListener(‘click’, alertHi);
Provided two DOM elementsconst div = document.createElement(‘div’);const paragraph = document.createElement(‘p’);how would you put the paragraph inside the div?
div.appendChild(paragraph);
The CSS property for setting the font color
color
What are the layers of the box model?
Content, padding, border, and margin
What color is rgba(0, 0, 255, 1); ?
blue
What command makes a folder into a git repository?
git init
What command will copy the file script.js into the javascript/ directory?
cp script.js javascript/
What command will create a new directory named css/?
mkdir css
What CSS property defines the spacing between flex items?
justify-content
What CSS rule do you apply to an element to make it a flex container?
display: flex;
What do the first two numbers in a hex code represent?
The red value