問題一覧
1
What is the definition of pseudo-class?
a keyword to define the special state of an HTML element
2
What can a pseudo-class keyword be used for?
add rules for an HTML element's style under certain conditions, add rules for an HTML element's style based on the element's position in the document tree
3
What is :root in CSS? What is the function?
a structural pseudo-class, indicating the top element in the HTML document, like html element
4
What is :empty in CSS? What is the function?
a structural pseudo-class, indicating the empty element in the HTML document
5
What is the html tag represent a container for introductory content or a set of navigational links?
<header>
6
How many <header> can a HTML file have?
many
7
What does <header> usually include?
one or more heading element (<h1 - h6>), logo or icon authorship info
8
Where does <header> cannot be placed?
<footer>, <address>, another <header>
9
What is the HTML tag specifies a section that is quoted from another source?
<blockquote>
10
What does browser usually do with the content tagged with <blockquote>?
Browsers usually indent <blockquote> elements
11
Which tag is recommended to use for inline short quotation?
<q>
12
What is the attribute of <blockquote>?
cite = “URL”
13
What is the priority of :root in CSS?
higher priority than any other HTML selector, override any style set using the html selector
14
Which things represent an element without any siblings. What is its identity?
:only-child, structural pseudo-class
15
Which html element will be selected by the CSS? p:only-child { color: blue; background-color: lightgrey; padding: 10px; } <div> <p>This paragraph 1</p> </div> <div> <p>This paragraph 2</p> <p>This paragraph 3 </p> </div>
paragraph 1
16
How the display:grid can be effective?
include the content of grid to become a direct child within a parent element of which has been set as display:grid
17
where should the border-collapse be placed to make the table have its style?
select the table tag of html
18
Can I use rowspan and colspan in HTML elements which are set as table, table row, and table cell?
no. They are specific for table data <td> and table header <th>
19
How to get border spaces between the table set by CSS?
use border-spacing: “value” in table element in CSS
20
Does the border set to the table will affect the border of the caption in HTML table?
no, the border will only effective to the table except the caption, because caption is not considered as part of the table body
21
Why something handling the inline element of HTML (like <img>) will show an unexpected white line below that tag?
it is likely caused by the default margin or padding applied to the <img> element. Browsers often apply default styles that can create unexpected spacing. We need to convert inline element into block, then remove the margin and padding of that element it can be solved by this CSS style .header img{ display: block; margin: 0px; padding: 0px; }
22
Before using margin:auto to horizontally center an element, what criteria should be considered?
if the element is an block level element?, if the width of the element has been set?
23
why adjusting the margin cannot stretch the responsive background outward?
margins are outside the element’s box model., The background color or image only covers the content, padding, and border areas of an element, not the margin area.
24
What is the criteria before using pseudo-elements and pseudo-class?
make sure the pseudo element and pseudo class work for which type of element, like only work for only work for block elements, or both work fine, like first-letter and first-line only work for block element
25
What are the default level type the texts which are only wrapped into a block-level div? Using inline element, like <\br>, can change it to be another type of level?
inline-level block, no
26
When both embedded javascript and external JavaScript are present in one folder, which one will be parsed first?
embedded javascript
27
If the value is not a numeric, then what is the result if using this value to mathematic operations? How can It prevent?
JavaScript will return NaN, prevent it by using isNaN(value) to check if the value is numeric. It will return true if the value is not a numeric value
28
If numbers are calculated in improper way, like 11/0, what is the output in JavaScript? How to prevent it?
JavaScript will return infinity as output, prevent it by using isFinite(value) to check if the value is a finite number. It returns true if the value is a finite number
29
How can the array be created in JavaScript?
var array = [“1”,”2”,”3”,”4”];, var array = new Array(“1”,”2”,”3”,”4”);, var array = new Array(10);, let array = [“1”,2,”3”,4];
30
What are the value of the empty space in array in JavaScript?
undefined
31
Is the length of JavaScript array fixed as Java and C#? Can the length of JavaScript array be changed in code after created, and how?
No, the length of array will automatically expand as more items are added, but it cannot automatically shrink when some items are deleted. The space with deleted item remain undefined, yes, the length of JavaScript array be changed in code after created. It can be done by indicating the length by arrayName.length
32
What is the function of sort() of array in JavaScript?
It directly sort the items of an array in alphabetical order, including numeric value
33
The sort() of array in JavaScript cannot sort numbers effectively. How can be solved?
using compare functions and put it as an argument in sort() method
34
What are the compare functions be coded and how can it be applied into sort() method?
for sorting number in ascending order function fname(a,b){ return a - b; }, for sorting number in descending order function fname(a,b){ return b - a; }, use the the compare function by: array.sort(fname);
35
Will the style set in the CSS override the same style set in the JavaScript?
no
36
What is function reference in JavaScript and how to use it?
it refers to a function without invoking it. It tells JavaScript to delay the function call, setInterval(timerRun, 50); function timeRun() { var time = new Date(); var realTime = time.toLocaleTimeString(); document.getElementById(“time”).innerHTML = realtime; }
37
what is the restriction when setting table as container?
empty cells will not take up verticle space, overflow beyond the container if not specifying table width, width of table columns are not same
38
when using tables as a layout, can we use display: flex to assign the table as flex item?
no
39
Can javascript apply on inline element, for example: <span> ?
Yes
40
What are the 6 common attributes of <input> used in lectures?
41
What are the 3 common attributes of <button>?
42
What is event attributes? Are they be used globally only?
43
What is the output of document.getElementsByName(“fname”)?
44
How to return the number of elements stored in document.getElementsByName(“animals”)?
45
What is NodeList and HTMLCollection? What are the similarities and differences between array?