Picture: img elements
src attribute: alt attribute image path: use when the picture can not be displayed alternate text title (global properties): Hover text displays the global attributes: Use within (the element common to all elements of property title, lang is what natural language )
Video: video elements
src attribute: Video Path (recommended mp4) controls property: a Boolean attribute [] When specified, will display the playback streamline autoplay: [after] a Boolean attribute specifies the video immediately enter the play state muted when the page is displayed: mute some of the new browser compulsory automatically enhance the user experience of the property to be set when playing loop: [after] a Boolean attribute is specified, the video will loop
Audio: audio elements
src attribute: audio path (recommended mp3) controls property: a Boolean attribute [] When specified, will display the playback streamline autoplay: [after] a Boolean attribute specifies the video immediately enter the play state muted when the page is displayed: mute some of the new browser compulsory automatically enhance the user experience of the property to be set when playing loop: [after] a Boolean attribute is specified, the video will loop
Figcaption represented by figure and a picture display unit and
Embedded elements
Overview: Embedded element is used to embed external resources img area map to a page embedded web video image resource to embed video to web page audio resources embedded audio resource embed object to a Web page embedded flash program data equivalent to the path to the page type is what type of embedded resources MIME format embedded iframe page to another page in FIG frameset page embedded waste
Line the box
Line box Overview
What is the line box: display attribute elements inline (default value) What are the most common box line text elements: span, abbr, em, i, strong, b, pictures and multimedia: img, video, audio
Understand the meaning of the line box: the specific content of the page (text, images, multimedia) will generate line text box: the box must be placed in the line, otherwise it will generate an anonymous line boxes pictures and multimedia: the default will generate line box, usually not for them box types change
Page contains content region, the cassette comprises a block row block box cassette cartridge is placed row block row box not place the cartridge element may comprise a block-level element row level, and the line level elements must not contain block elements, except for a standard element old the new standard completely abandoned this rule, new - do not include the paragraph heading, paragraph do not include the area or title
Salient features of cassette rows
Cassette row may be broken, because the content may be broken by wrap word-break breaking property comprising the same block, a plurality of consecutive horizontal rows are sequentially arranged cassettes
Blank folding rules are applied only between the box and the row between the row lines inside the cartridge and the cartridge box row distance margin and padding may be used in the horizontal direction is provided
The size of rows box
Line replaceable cartridge elements: Photo and Multimedia
When the cartridge is fully consistent with the block of pictures and videos, provided only a broad high school, another scale will automatically adapt to the pictures and videos, If both width and height, can not be inherited by the object-fit adaptation property object-fit manner meaning: how to adapt the dimensions of the content, only the default values for the alternative element fill: ignore the aspect ratio zooming, the full size of the set value: Contain: maintaining the aspect ratio zooming, and to ensure that the contents of the cassette without departing Cover: holding aspect ratio zoom, full size set, some parts are hidden none: without any scaling
Alternatively non elements: Text earth element
Invalid width and height (width and height depending on the size of the content) in the vertical direction of the margin, border, padding layout does not occupy the space may be provided using the line-height of the text line height line-height Attribute Meaning: row height inheritable Default: Normal: use the browser default line-height values: 20px, fixed value, line height, 20 pixels 2em: relative value, according to the current element font size calculation, after computing elements inherit 200%: same 2em 2 [recommended]: according to the current elements font size calculation, the value of the quilt before computing elements inherit
property can be used for line-height vertical center line text
Position of the line box
Buter cassette rows must be a conventional float flow and absolute positioning of the cartridge case automatically changed blocks in the row block containing cartridge, the cartridge away from the block floating line and comprising a regular stream cassette boxes, text-align can be used to adjust the cassette row alignment between its inner cartridge alignment line may be used to adjust the vertical-align] [understand each row comprising a row element cassette and cassette, creates a plurality of reference lines aligned rows cartridge using the default limits in its interior vertical- align: baseline: baseline limits their alignment block comprising normally
May be used to adjust the vertical-align and push the text before and after the alignment may be used to eliminate vertical-align the cartridge with the outside bottom row block boxes voids
Box line block
What like cassette row block row box display attribute value inline-block element box generated line block in some respects the performance of the cartridge, the cartridge inner block row block to the cartridge box and certain aspects of the performance difference can place a cassette row All dimensions box model row block row cassette cartridge is not valid, the margin line on the cassette cartridge not row in the vertical direction, border, padding size does not occupy a high spatial line width and height can not be set
Row block box commonly used in a wide high-level automatic centering
Line box common development scenarios
1. In a plurality of boxes arranged in a row, the row box used with caution, since the blank 2 is folded between the rows of vertical center line text box, line height when the height of the block 3 comprising a region to a unified set of rows can be set high, to meet the different font size, line height is recommended to set unitless, often with the body element is provided to direct to 4. {display: block; float: left;} can be simplified as {float: left}, and since absolute floating the positioning element automatically blocks the cartridge 5. to adjust the vertical alignment of the cartridge between the rows, a white border can be provided by a bottom 6. the vertical-align image, image blocks is set to the cassette or to adjust the picture 7 vertical-align property. an element adapted to the width of the content, while some of the required size in the vertical direction while centering the need, to consider setting the line block element box, set the parent element text-align: center
Block-level formatting context
Block Formatting Context 简称 BFC IFC Inline Formatting Context
He is a rendering independent area, which has been specified in this region, the layout of a conventional cassette stream chunks
Conventional cartridge stream block in the horizontal direction, the block must support full regular stream block comprises a cartridge placed successively in a vertical direction comprise a conventional block stream block adjacent cassette when the seamless margins, a conventional merge is performed from the outside of the cassette stream block automatic placement and height, ignoring the floating element
BFC rendering area in the region created by an HTML element, the following elements are created in the interior region of BFC:
It means that the root element <html> BFC common element region, covering all of the pages cassette block floating elements and the overflow is not equal to the absolute positioning elements visible in
Flexible pouch table display: table
BFC different areas, when they interfere with each other to create render elements of the BFC, cut off from its internal and external links, internal rendering will not affect the external specific rules:
BFC created elements, which need to calculate the height of the floating element (floating height collapses solution) to create BFC element, it does not overlap the border of the housing element to create the BFC and the floating elements, and will not perform its sub-elements combined Margins
Page production process review
0. obtain design
1. divided area of the page
HTML: structural elements
CSS: Box Block
2. Content filling region
HTML: text, images and multimedia elements, etc.
CSS: Line box
Pictures and Multimedia
Picture: img elements
src attribute: image path
alt attribute: pictures can not be used when the alternate text display
Text displayed when hovering over: title attribute
Video: video elements
src attribute: Video Path
controls attribute: [] after the specified Boolean property, will display the playback controls
XXX = "XXX" The wording of the property called Boolean attribute
Boolean attribute only two states, of specified and unspecified
Boolean property can be written to only attribute names
autoplay: [after] a Boolean attribute specifies the video on the page will immediately enter the play state display
Audio: audio elements
src attribute: audio path
controls attribute: [] after the specified Boolean property, will display the playback controls
autoplay: [after] a Boolean attribute specifies the audio on the page will immediately enter the play state display
Figcaption represented by figure and a picture display unit and
Alternatively elements and non-replaceable element
Alternatively: Element display content, determined by its properties, such as img, video, audio
Non-replaceable elements: display the contents of the element, the element is determined by the content, most of the elements are non-replaceable elements
Embedded elements
Outline
Embed page
Use iframe element can be embedded in the page to other pages
Embedded flash program
Using object or embed elements, external resource may be embedded in the page,
It is typically embedded flash program