1, block-level element row-level elements?Block-level element features:① always start on a new line;② height, row height, margin and inner margin can be controlled;The ③ width defaults to 100% of its container, unless a width is set;④ it can accommodate inline elements and other block elements.Features of inline (inline) elements:① and other
Jquery filter elements (1) and jquery filter elements
. Eq ()Reduce the set of matching elements to the element of the specified index.. Eq (index)Index is an integer that indicates the position of an element, based on 0.$ ("Li" ).eq(2).css ('background-color', 'red ')// Select the third element to change the background to red.. Eq (-index)-Index is an integer th
Use float and display:block to convert inline elements to different points of block elements:recommendation : As far as possible handwriting code, can effectively improve the learning efficiency and depth.Inline elements can be converted to block-level elements, such as the use of the float property for inline elements
Use float and display:block to convert inline elements to different points of block elements:Inline elements can be converted to block-level elements, such as the use of the float property for inline elements to float inline elements, or to add display:block to inline
block-level elements:Div, P (paragraph), form (form), UL (unordered table), Li (list item), OL (with serial list), DL (definition list), HR (horizontal split line), menu (List of menus), table (table) ... Features:1, block-level elements will be exclusive row, its width automatically fills its parent element width.2, you can set the Width,height property. (even if the width is set, it is exclusive, except in special cases such as the float property)3
1 HTML chunk elements: most HTML elements are defined as block-level elements or inline elements . 1.1 Block-level element example: Characteristics of block-level elements: Exclusive line, can be set to wide height1.2 row-level element instance :Row-level element features: O
references when programming in scripts.3. A reference to a form can take advantage of the name property of the from tag, or it can be called to the corresponding array using the forms[] array of document.4. You can use the elements[] array of form form to traverse all elements except 5, the form form of the Submit () method is used to submit the form to the service, but when we click the Submit button, the
The features and differences between block elements and inline elements.
Features of block-level elements: 1. occupies a whole row.2. It is a rectangle.3. You can define the width and height, inner margin, and outer margin.4. Its display attribute is block by default.Characteristics of inline elements: 1. It does not o
How to Select k elements from n elements with equal probability? This problem is a reservoir sampling. The algorithm can be described as follows:
Init: A reservoir with the size: K
ForI = k + 1ToN
M = random (1, I );
If (M
SwapTheMThValueAndIThValue
End
Someone has provided proof on the Internet and first forwarded it:
[Switch]
Proof:
Each time it is selected based on the probability of K/IFor example, i
I. Before CSS
Before CSS, the content and format of the webpage are connected.
The effect is:
If you want to make the news content different from the news category in font color, modify the corresponding code. If you have a lot of content and want to modify the style of many content, one modification is obviously not a good method. CSS is required.
Ii. What is CSS?
Cascading Style Sheet (CSS) is also called style sheet. It is used for webpage style design. Is a computer language used to
Js obtains the width and height of hidden elements, and js obtains hidden elements.
There are some js methods on the Internet to obtain the width of hidden elements, but some situations may fail to be obtained.
For example:
Test is obtained, but test2_child is not obtained. In view of this situation, I wrote a solution myself.
Solution:
1. obtain all the hidden
How inline elements and block-level elements convert to each other:Inline elements and block-level elements can be converted to each other, and the conversion method is briefly described below.I. Inline elements are converted to block-level elements:Make the inline element f
1, block-level elements of the characteristics:(1) The contents of block-level elements, or background images, are displayed by default in the upper left corner of the block(2) block-level elements, which, by default, occupy a single line.Commonly used block-level elements: Div, p, H1-h6, HR, ul Li, Ol Li, table, body
JQuery method for obtaining all parent and peer elements and child elements (recommended ).
1. Get the parent Element
$("#id").parent()
Obtain parent-level elements
$("#id").parents()
Obtain all of its ancestor Elements
$("#id").closest()
Obtain the most recent ancestor elements
Learn jQuery selector today:JQuery selectors include basic selectors, hierarchical selectors, filter selectors, and form selectors.Basic selector: id, class, label name, *, element combination (div, span, p. myClass)Level selector:Difficulty: differences between jquery neutron elements and descendant ElementsThe descendant, that is, all descendants of the current element, are counted,Child element, which is a subset of the current element, is not coun
1. If the form element is refreshed with a js value assignment, the record is the value after the js value assignment, not the initial value.
Ii. Non-form elements record the initial values after being refreshed with a js value assignment
After the element is bound to the toggle in jquery, the element is hidden. At the beginning, I didn't think it was a problem here, I found out that it had been more than a month since I bound the toggle method to my internship today. The company has assigned me very few tasks. Ah, I feel a little uncomfortable. In this case, I still have something to do. To put it bluntly, when I was writing my graduation project today, a miracle occurred after I bound jquery's toggle method to an element. All t
The most comprehensive method for horizontal vertical center of elements and the most comprehensive method for vertical center of Elements1. Horizontal Center 1.1 known width block element width:
.child{width:1000px;margin:0 auto;}1.2 text content center:
.parent{text-align:center;}1.3 form:
.child{display:table;margin:0 auto;}1.4 If the width is known, set position: absolute and margin-left to the negative half of the width.
.parent{position:relative
Basic HTML elements (3) and html elements1. Special HTML characters
Some characters have special meanings in HTML. For example, the lower sign (
In another case, HTML automatically removes unnecessary spaces. If you input 10 spaces consecutively in the document, HTML removes 9 of them. The character entity is used to implement any space.
Character entities are used to insert special characters into HTML documents in two ways:Entity characterAndEntity
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.