Html & CSS Flashcards
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.