css and js basis

CSS Styles

Setting the width and height 1

       Block elements may be used wid

 

1 fonts

    font-family: text type

    font-size font size

    font-style italic italic font styles normal normal

    font-weight font weight (100-900) normal normal bold bolder serif lingther

    chorm default 16px Microsoft elegant black

List 2

    none labeled modified list-style set style removed

    The list-style-position mark position disposed inside the outer list li li list Outside

 

3 box model

    内容+padding+border+margin

    Padding within a boundary (Beijing extends inside visible)

    boeder border

    the outer boundary margin (not visible)

       Arrangement padding: 50px (four sides are the same)

                  padding: 50px, 10px (down 50, 10)

                  padding: 50px, 10px, 5px (50, the right 10, 5, with the left and right)

                  padding: 50px, 10px, 5px, 1px (bottom right on the left) counterclockwise

4 centering adjustment elements

    line-height line height

Alignment block and the text-align within the block row in the horizontal direction can be used (provided centrally)

vertical-align its manner of rows in the vertical direction | within the effective line block (installation height center)

5 floating

    float: left | right move in the specified direction, you encounter other floating elements or browser border stop

    Semi streaming content from the document to make the position in front of the floating element (originally used to implement text wrapping)

       It is mainly used to implement the block elements side by side

      

       Floating Clear

1 property to the Clear: left / right / both left or right elements can not recommend the use of both floating elements

Control only one side, the other side is controlled by the other floating elements, to avoid the display peer

Floating element 2 disposed outer parent element or set the height of the parent element of the parent element attributes overflow: hidden

       By controlling parent element comprising inside the main floating elements required to adapt the height of the child element of the parent element

6 Location

position positioning properties comprising:

    relative positioning without departing from their original relative position with respect to the positioning of document flow

Line connecting block elements can be realized, but the original position is still occupied

    absolute absolute positioning from the document flow (to cancel the original position) absolute position

If the parent element is disposed relative movement relative to the parent element

If the parent element is not disposed relative positioning of the opposing form

    fixed fixed positioning departing from the document flow (home position canceled)

View the positioning relative to ignore the browser's scroll bar

You need to set up in conjunction with the top bottom left right property

 

7 image properties set high = 100%, width = 100% represents all the space occupied parent principles

   

JavaScript

1 Basic Concepts

Js client-side scripting languages: ECMAScript core basic grammar describes the syntax and basic objects

                   DOM Document Object Model describes a method of processing web content and interfaces

                   Methods BOM browser object model describing interacting with the browser's interface

Js in everything is an object

2 is defined way

    Defined within the tag line

    Within the script tags within the internal html document

    External js external definition files, the introduction of the html  

You can not define a script and the introduction js file js code

Js recommended that define the position of html

    Head in ease of maintenance, may not get element node to set window.onload

    Before the end of Body elements can get all nodes

 

Notes with the same three kinds of java

 

3 Data Types

    Simple data types

        String Displays single quotes black / escape character in double quotes applicable

        Number purple numeric display includes an integer, decimal, NaN

        Boolean Boolean true / false

        Undefined Undefined assignment undefined; unassigned statement

        Null empty assignment null, not obtain elements

        Method function function (parameter) {}

    Complex data type / object type

        {Key: value, key: value} key data in the form of

    Acquiring the data type of the operator

        typeof (data) null object method returns and

 

4 Variable Scope

Variable declaration

    1 var variable name (direct assignment, may be the first statement after the assignment, the assignment is determined according to the type of data)

    2 variable name (direct statement)

    A plurality of three consecutive statement format: var a, b, c

var a, b, c = 10 (to which the assignment c) var aa = 11, bb = 12, cc = 10 (all assigned)  

    4 If the object has been declared invalid rewrite the statement, but the statement assigned to cover the original value

        var box = 10; var box = 15; box 10 is   

Scope tag includes two types of external and internal script function method

    Global Variables scope local variables for the whole script is only useful function in

 

Scope upgrade

    Var variables declared in the presence scope scope lifting effect, but only to enhance the variable declaration (including method)

    Local variables var variables can be used outside

Methods no exception var declared local variable method is called,

External able to use the method of the following local variables in the code

 

 

5 Data type conversion

1 automatic conversion

    + - operator

    Digital (+ -) boolean Boolean Switch 0 (false) and 1 (true)

    Numeric string string concatenation +

2 cast

    String () method returns a string method name code is returned

Boolean () and non-empty string is other than 0 ture; others are false

    Number () returns an empty string and spaces 0 string

                   Pure digital string Returns

                   Non-pure numbers NaN

                   boolean 0 or 1

                   null                   0

                   undefined              NaN

    The method of string-to-digital (recommended)

the parseInt () Analysis character string index position 0

If you find the first valid character valid integer if the first concurrent valid characters return NaN

    parseInt (string, decimal numbers) of the binary number can be acquired

    parseFloat () analysis of the first character in order to obtain a valid decimal header otherwise only recognize decimal NaN

   

Operators 5

== Direct comparison content (string of the digital direct comparison)

=== simultaneously compare data types and content types to compare, if not direct false

! Negated reusable !!! true to false

{} Scope does not have the effect, only to distinguish the code blocks

And the rest with java

 

6 Array

Features : variable length, any stored data (a plurality of types of memory), the index starts from 0

Created :

       [Data, data, data ...] recommendation

       new Array () to create an empty array

       new Array (value 1, value 2 ...) assigned to create

EG was scar = [true, false, 1, 'red']

 

Index assignment  array name [index] = value

              If the index is greater than the length, the assignment is possible, the spacer element is undefined

              If other non-normal index value and the index, as an array of custom attributes is present, KV form

Traversal

Ordinary for

       for(i=0;i<arr1.length;i++){console.log(arr1[i]);}

for ... in ... cycle

       for (var index in the array) {console.log (i + '---->' + arr1 [i]);} can traverse all the index value comprises a non-normal

forEach (function (refer to values, refer to the index, array)) refers to the index values ​​and refer to pick variable

method

slice () does not change the original array taken

       A parameter from the specified parameters taken at the end

       2, taken from the front parameters Parameter 1 Parameter 2 to close the opening at index

splice () taken to change the original array

       A parameter from the specified parameters taken at the end

       2 parameters taken from the parameter 1, parameter 2, taken in length

       3, taken from above parameters and parameter 1, parameter 2, taken in length, filled parameter taken after the position of the original array 3

 

7 function

Function declarations

function function name ([parameter list]) {...}

Call the       function name (arguments)

              After the external brackets, can be converted to function expressions plus () calls directly

              Before the function declaration plus + - after the function expression into plus () calls directly

              Function name from the function call can not recall

Function expression

var variable = function [function name] (parameter list) {...}

Call       variables (arguments)

              After the function expression plus () directly calls attention, since variables can not call then call

              Note that external functions can no longer be called directly by the method name, a single method internally defined recursively using the method name

Anonymous function

(function( ){ … } )( );

 

 

The method can be used in return return return value, if no return is regarded as return Undefined

Parameter necessary to specify a list of data types

When calling the lack of parameters, parameter regarded as undefined, press the multi-parameter acquisition order

Guess you like

Origin www.cnblogs.com/javaxiaobu/p/11080839.html