recent interview questions (1)

I sorted out the interview questions I encountered, and if there are any inappropriate answers, please give me more advice

  • The difference between row-level elements and block-level elements
    1. Row-level elements cannot be set to width and height, and cannot be single-line. Block-level elements have width and height, and are single-line. (I only answered this one.. sad)
    2. Block-level elements can contain row-level elements, but row-level elements cannot contain block-level elements
    . 3. There is also the difference between margin and padding. The margin of row-level elements can only be set to left and right. padding can be set to bottom right and left.
  • The box model of the element The
    element can be regarded as a box, which consists of four parts, content, padding, border, margin
  • Global attributes of html (refer to the document)
    http://www.w3school.com.cn/tags/html_ref_standardattributes.asp
  • various centering
  • What selectors does CSS have, and what is the priority?
    Id selectors, class selectors, tag selectors, attributes, pseudo-classes, descendants, descendants, grouping, pseudo-elements. . . Commonly used selectors, if the id selector counts as 100, the class selector is 10, and the label selector is 1.

  • How to customize attributes, have you used the
    js methods setAttribute and getAttribute in the project, .attr is used in jQuery, one parameter is to get the attribute, two parameters are to set the attribute, and the custom attribute usually starts with data-.
    About his application 1. Match the correspondence, set the same attribute to control, like the index in the carousel. 2. Equivalent to the switching of the switch, refer to the article https://www.cnblogs.com/jnslove/p/5296823.html

  • How to achieve animation
    Now think about it, maybe the interviewer means this
    . 1. Set the transition through transition, and then set the shape effect through transfrom
    2. Use the animation property to set the effect directly.
    What I answered at the time was 1. Using the animation property 2. Using keyframes to define the animation . 3. Later, I also answered the use of jquery to achieve the effect
  • What is variable hoisting?
    Function and variable declarations will be hoisted to the top, so they can be used first and then declared in the code.

  • What method is used in jQuery to detect whether the DOM tree is loaded, and the principle?
    Use $(doument).ready(), similar to him is window.onload(), ready is executed after the DOM structure is loaded, the latter is executed after the DOM structure and elements including pictures are loaded, ready in Execute before onload.
    The principle can be seen in the source code or refer to this article http://www.cnblogs.com/a546558309/p/3478344.html

  • The method of judging equality (string)
    can use == or ===, == requires equal values, types can be unequal, === is identity

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326874358&siteId=291194637