Technical Questions Flashcards
What does doctype do?
Doctype is the abbreviation for the document type, Doctype declaration tells the browser
what kind of document to expect. If you don’t declare the doctype, browsers can interpret the document as something else other than HTML
How do you serve a page with content in multiple languages?
We can set the language in the HTML document by setting the lang attribute in the code. By default, the specified language is English, but it can be changed at our convenience.
By default:
You can set the whole site as being english by setting the html element Or you could set a paragraph as spanish with <p></p>
What kind of things must you be wary of when design or developing for
multilingual sites?
- Sentence length/Text overflow when translated
- Formatting Dates Calendar dates are sometimes presented in different ways For Example, May 31, 2012 in the US. vs “31 May 2012” in parts of Europe.
- Text In Images Won’t Scale
- Be Mindful af How Colors Are Perceived Across Different Cultures
What are data- attributes good for?
Explanation: They store data private to the page or application
Use: They were often used for storing extra data in the DOM, but are generally discouraged now.
Consider HTML5 as an open web platform. What are the building blocks of
HTML5?
- Semantics: allowing you to describe more precisely what your content is.
- Connectivity: allowing you to communicate with the server in new and innovative ways.
- Offline and storage: allowing webpages to store data on the client-side locally and operate offline more efficiently.
- Multimedia: making video and audio first-class citizens in the Open Web
- 2D/3D graphics and effects: allowing a much more diverse range of presentation options.
- Performance and integration: providing greater speed optimization and better usage of computer hardware.
- Device access: allowing for the usage of various input and output devices
- Styling: letting authors write more sophisticated themes
Describe the difference between a cookie, sessionStorage and localStorage
the server with HTTP request.
sessionStorage and losalStorage are initiated by the client and aren’t sent to the server.
The main difference is that localStorage will stay forever until it Is cleared manually.
Describe the difference between script, script async, and script defer
HTML parsing is blocked, script is fetched and executed immediately.
- async scripts load in the background and run when ready. The DOM and other scripts don’t wait for them, and they don’t wait for anything. A fully independent script that runs when loaded.
The defer attribute tells the browser not to wait for the script. The script loads “in the background”, and then runs when the DOM is fully built
Why is it generally a good idea to position CSS «link»s between ¿head» «/head>
and JS «script>s just before
Putting <1ink>s in the chead» allows for quick “first meaningful paint”. When a page first loads, HTML and CSS are being parsed simultaneously. Conversely script> tags block HTML parsing while they are being downloaded and executed which can slow down your page. Placing the scripts at the bottom will allow the HTML to be parsed and displayed to the user first.
Exceptions: When your script contains document. write, however it isn’t consider good practice to use document. rite Also if you need scripts to run on page load it may be beneficial to split them out from your main script and place in the head.
What is progressive rendering?
Explanation: Techniques used to improve the performance of a webpage to render content for display as quickly as possible.
Use: Improving percerved load time
Example: Lazy loading of images. Prioritizing visible content (or above-the-fold rendering) and Async HIM fragments
Why you would use a srcset attribute in an image tag? Explain the process the
browser uses when evaluating the content of this attribute
Explanation: When you want to serve different images to users depending on their device display width.
Use: Sending lower resolution to limut data waste and increase performance or sending larger images to a higher resolution display to enhance the UX
Example: < img srcset=”omall.jpg 500w. mediun.jpg 1000w, large.jog 2000w” arC=”
“ alt=“”>
Have you used different HTML templating languages before?
EJS and React (JSX)
What is CSS selector specificity and how does it work?
Explanation: The means by which browsers decide which CSS property values are the most relevant to an element and, therefore, will be applied.
Use: Specificity is a weight that is applied to a given CSS declaration, determined by the number of each selector type in the matching selector.
Example: A selector of #id .class tag would have 111 points as id’s count for 100, classes for 10 and tags 1.
What’s the difference between “resetting” and “normalizing” CSS? Which would you choose, and why?
Explanation: “Normalize” alters the default styles of various browser to match each other. “Reset” will remove the browsers default styles so you are starting from scratch.
Use: Applying one or the other is done to try and make websites visually consistent across different browsers. I prefer to use a mix of both. Starting with the normalize to keep it conscise and then add some elements like anchors and headers with a reset. Going full “nuke” is often unnecessary and creates a larger, harder to debug file.
Describe floats and how they work.
Explanation: Floats are a positioning property where the element that is floated will be removed from the flow of the page and affect the elements around it. A parent element will collapse to zero height if it contains only floated elements, to fix this it was common to use a .clearfix hack.
Use: It was used prior to flex and grid to layout pages in a more flexible manner.
Example: You could float three elements left and give them widths of 33% to create three even width columns.
Describe z-index and how stacking context is formed
Explanation: The z-index property in CSS controls the vertical stacking order of elements that overlap. A stacking context is an element that contains a set of layers. The z-index values of its children are set relative to that element rather than to the document root. Layers outside of that context can’t sit between layers within it.
Describe BFC (Block Formatting Context) and how it works.
Explanation: A BFC is an HTML box that satisfies at least one of the following conditions:
The value of float is not none.
The value of position is neither static nor relative.
The value of display is table-cell, table-caption, inline-block, flex, or inline-flex, grid, or inline-grid.
The value of overflow is not visible.
Use: Knowing how to establish a block formatting context is important, because without doing so, the containing box will not contain floated children.
Example: Without forming a BFC you could have content of a float that is taller than the content alongside it. The border of the parent element could then “cut-through” the floated box.