Home > Article > Web Front-end > CSS Div interview questions_html/css_WEB-ITnose
1. What is the difference between 80px and 80% when defining the width of a table in HTML?
px represents pixels, and % represents the percentage of the entire page width.
2. Briefly describe the difference between DIV elements and SPAN elements.
DIV is displayed in separate lines by default, and SPAN is displayed in the same row.
3. What are the values of position in HTML page layout? What is the default value?
1) The five values of position are static, relative, absolute, fixed, inherit
2) The default value of position is static
4. How to make a layer with a width of 200px and a height of 200px Vertically centered in the browser? Write CSS styling code.
Percentage and absolute positioning are used here, and the method of outer patch negative value, the size of the negative value is half of its own width and height.
5. In the CSS specification, what does . (period) followed by a name mean? What does # (pound sign) followed by a name mean? If you want to set a CSS style (inline style) on an element, in what attribute should you write the CSS style?
1) . (period) followed by a name indicates that all class attribute values in the document that contain this name apply their styles,
2) # (pound sign) followed by a name indicates that the ID in the document has this name. Element applies its style.
3) CSS styles are written in the style attribute.
6. What is the specific meaning of CSS? Why use CSS technology in web page production?
CSS (Cascading Style Sheets) is also called cascading style sheets. It is used to control the appearance of one or more elements in a web page. In web page production, the use of style sheets can reduce the repetitive setting work of many elements with the same appearance, thus bringing great convenience to the design and maintenance of web pages; the specific application is: changing the definition of the display style of elements in the style sheet, then The display style of the corresponding elements will automatically change in all web pages that use this style sheet.
7. What are the advantages of CSS DIV in developing web pages?
1) CSS DIV, in this web design pattern, DIV takes on the content of the web page, and CSS takes on the style of the web page. This separates the content and style of the web page. Conducive to page maintenance and upgrades.
2) Helps to improve search engine affinity (quickly find the data you need, instead of searching layer by layer in TABLE)
3) Helps to reconstruct the page (change the skin such as blog, directly This can be achieved by applying another set of styles without changing the web script)
8. An HTML document must contain three elements, which are head, body and which one?
html
9. Should inline document comments in HTML begin with 10. What are the ways to reference CSS styles?
1) Import an existing CSS file: 2) Declare a CSS code segment directly in HARD:
3) Directly declare the CSS style in the web element: style=”color:red;”
11. What is the difference between the settimeout and setinteval functions in JavaScript?
settimeout is only executed once, and setInteval has no limit on the number of times.
12. Write a JavaScript script to generate an integer between 1-6?
var NowFrame;
NowFrame=Math.random( )*6 1 //Randomly generate a decimal between 1-6
NowFrame=parseInt(NowFrame) //Put a decimal between 1-6 Convert to integer
13. What attributes can be set to hide and show a DIV? What are the values?
1) When the value of the diasplay attribute is set to none, the layer is hidden.
2) When the value of the diasplay attribute is set to block, this layer is displayed.
14. What is the role of isNaN in JavaScript scripts?
The function of isNaN is to determine whether the value is a number
15. What are the ways to obtain an element in JavaScript?
document.getElementById(); This method is used to get the element named ID value
document.myform.xxx; This method is used to get it according to the hierarchical structure
document.getElementsByName(); This method is used to get All elements with the same name
16. What are the advantages and disadvantages of Ajax?
Advantages of Ajax:
1) The page does not refresh and the user experience is very good.
2) Use asynchronous communication with the server for faster response.
3) You can transfer some of the work burdened by the server to the client and use the idle capacity of the client to process it, reducing the burden on the server and saving space and broadband rental costs. And to reduce the burden on the server, the principle of ajax is to "fetch data on demand", which can minimize the burden on the server caused by redundant requests and responses.
4) Based on standardized and widely supported technology, there is no need to download plug-ins or applets.
Disadvantages of Ajax:
1) Ajax does not support the browser back button.
2) Security issues, Ajax exposes the details of interaction with the server.
3) The support for search engines is relatively weak.
4) Destroys the exception mechanism of the program.
5) Not easy to debug.
17. Briefly describe the working principle of Ajax.
The core of Ajax is the JavaScript object XmlHttpRequest. This object was first introduced in Internet Explorer 5 and is a technology that supports asynchronous requests. In short, XmlHttpRequest allows you to use JavaScript to make requests to the server and handle the responses without blocking the user.
18. How many data types are there in JavaScript? What are the differences?
There are 7 data types in JavaScript, namely:
1) Number numeric type
2) String string type
3) Boolean Boolean type
4) Function function
5) Object object
6) Null
7) Undefined No defined type
19. In JavaScript script, what is the result of expression 2 5 "8"? And explain why.
Because 2 and 5 are numeric types, and "8" is a string type, the result of the addition is 78.
20. Write a JavaScript script to hide the real address of a hyperlink.
The code example is as follows:
onMouseOut='window.status="Done"; 'href="http://www.affiliate-url-here.com" target="_blank">Link Text Here