Html & CSS Flashcards
(39 cards)
What is SVG?
“SVG” stands for “Scalable Vector Graphics”.
What is XML?
XML (aka, “Extensible Markup Language”) is an HTML-like syntax which is used for lots of things, from APIs, to RSS, to spreadsheet and word editor software.
What is a binary file?
A binary file is a computer file that is not a text file.[1] The term “binary file” is often used as a term meaning “non-text file”.[2] Many binary file formats contain parts that can be interpreted as text; for example, some computer document files containing formatted text, such as older Microsoft Word document files, contain the text of the document but also contain formatting information in binary form.[2]
What is the xmlns attribute?
xmlns stands for “XML NameSpace”. This specifies what dialect of XML you’re using. In our case, that dialect is the SVG language spec. Without it, some browsers will not render your image or will render it incorrectly.
What are some situations where you wouldn’t want to use SVG?
They are extremely inefficient at storing complex images. If your image is supposed to be photo-realistic, or it has fine detail or texture (“grunge textures” are a great example), then SVGs are the wrong tool for the job.
What are the benefits of “inlining” your SVGs? What are the drawbacks?
SVG’s properties will be visible to your code, which will allow you to alter the image dynamically via CSS or JavaScript.
some serious drawbacks: it makes your code harder to read, makes your page less cacheable, and if it’s a large SVG it might delay the rest of your HTML from loading.
How to remove the extra spacing in a table between the first row and the rest?
table {
border-collapse: collapse;
}
How to add padding to the data in the table cell ?
td, th {
border: 1px solid #999;
padding: 0.5rem;
text-align: left;
}
Note that there’s always only td, th in a table
HTML table
How to provide common styling to columns?
HTML has a method of defining styling information for an entire column of data all in one place — the <col> and <colgroup> elements.
These exist because it can be a bit annoying and inefficient having to specify styling on columns — you generally have to specify your styling information on every <td> or <th> in the column, or use a complex selector such as :nth-child.
Styling columns like this is limited to a few properties: border, background, width, and visibility. To set other properties you’ll have to either style every <td> or <th> in the column, or use a complex selector such as :nth-child.
Without col, have to style on the td/th:
<table>
<tr>
<th>Data 1</th>
<th>Data 2</th>
</tr>
Instead col elements are specified in a colgroup container
<table>
<colgroup>
<col></col>
<col></col>
</colgroup>
</table></table>
Why would you want a CSS reset?
To fix the problems with default styles on different browsers
CSS: What are absolute units?
Absolute units are those that are the same in any context.
px is an absolute unit because the size of a pixel doesn’t change relative to anything else on the page. In fact, px is the only absolute unit you should be using for web projects. The rest of them make more sense in a print setting because they are related to physical units such as in (inch) and cm (centimeter).
What are some instances where you might want to use vh and vw?
Viewport units
The units vh and vw relate to the size of the viewport. Specifically, 1vh is equal to 1% of the viewport height and 1vw is equal to 1% of the viewport width. These can be useful any time you want something to be sized relative to the viewport, examples including full-height heroes, full-screen app-like interfaces.
What is em?
If the parent font-size is 16px, what is 1em ?
The em is a relative unit that refers to the font-size of the parent’s element. So, if a parent’s font-size is 16px, then 1em would be 16px and 2em would be 32px. An important thing to realize with em is that if the font-size of an element changes, so does the value of em. So, if you set some element’s font size to 2em, and one of its children is also 2em, the calculated value of those 2 font-sizes will not be the same. The child will be double the size of the parent.
What is rem?
A rem is very similar to an em except that instead of always referring to an element’s parent, it always refers to the font size of the root HTML element.
So, for example, if a parent and child both get 2rem, the calculated value will be the same.
What is viewport width (vw)?
Viewport Width (vw) – A percentage of the full viewport width. 10vw will resolve to 10% of the current viewport width, or 48px on a phone that is 480px wide.
The difference between % and vw is most similar to the difference between em and rem. A % length is relative to local context (containing element) width, while a vw length is relative to the full width of the browser window.
What is viewport Height?
Viewport Height (vh) – A percentage of the full viewport height. 10vh will resolve to 10% of the current viewport height.
What is Viewport Minimum (vmin)?
Viewport Minimum (vmin) – A percentage of the viewport width or height, whichever is smaller. 10vmin will resolve to 10% of the current viewport width in portrait orientations, and 10% of the viewport height on landscape orientations.
What is Viewport Maximum (vmax)?
Viewport Maximum (vmax) – A percentage of the viewport width or height, whichever is larger. 10vmax will resolve to 10% of the current viewport height in portrait orientations, and 10% of the viewport width on landscape orientations. Sadly, and strangely, vmax units are not yet available on Internet Explorer or Edge.
What are the 2 ways to add fonts that are not installed on a user’s computer?
Web fonts
If you want to use a font that will not be available on the user’s device, you will need to import the font from an online source, either a font library or an asset on your site.
To use a font from one of these libraries, go to the website, select a font and then copy a snippet from the website to import that font from their server into your website. You’ll be given either a <link></link> tag to put in your HTML like so….
… or an @import tag that can be dropped at the top of a CSS file.
What is the ‘system font stack’ and why would you want to use it?
The system font stack
If you use the font-family property to change to a font like impact or Times New Roman, and those fonts do not happen to be installed on your user’s computer, then a fallback font will be displayed.
body {
font-family: system-ui, “Segoe UI”, Roboto, Helvetica, Arial, sans-serif, “Apple Color Emoji”, “Segoe UI Emoji”, “Segoe UI Symbol”;
}
Which property would you use to increase or decrease the space between letters in a word?
letter-spacing
Letter spacing does what you would expect…. it changes the space between letters in a word. This can be useful for adjusting custom fonts that you feel have too much or too little space. It can also be aesthetically pleasing in some cases, like headers.
Which property would you use to increase or decrease the space between lines in a paragraph?
line-height
Line height adjusts the space between lines in wrapped text. Adding a little line-height can increase readability.
Which property would you use to make an element transparent?
Opacity
Which property would you use to make a background image tile?
background-repeat;