If the same element has two or more conflicting CSS rules, the browser has some basic rules to decide which one is very special and wins.
It may not be as important as others, and most cases you don't need to worry about conflict, but large and complex CSS files, or a lot of CSS files, can create conflicts.
In the case of a selector, the previous attribute wi
Csspseudo-classesareusedtoaddspecialeffectstosome selectors. A CSS pseudo class can be used to add special effects to some selectors. Hyperlink How to add a different color to a hyperlink in a document thisexampledemonstrateshowtoadd Differentcolorstoahyperlinkinadocument. examples instance:
The code is as follows
Copy Code
Source Code to Run []a:link {color: #FF0000}a:visited {color: #00FF00}a:hover {color: #FF00FF}
Please note that some CSS pseudo class properties are not supported by all browsers, but there are four pseudo classes that can be safely used on links Pseudo class like the latch that specifies the selector State or association selector. They are in the form of: SELECTOR:PSEUDONBSP;CLASSNBSP;{NBSP;PROPERTY:NBSP;VALUE;NBSP, which uses a colon between the selector and the Pseudo property. link links that have not been clicked visited with clicked
In accordance with the CSS specification, floating elements (floats) are moved out of the document stream without affecting the layout of the block box but only the arrangement of the inline box (usually text). Therefore, when its height exceeds the containing container, the normal parent container does not automatically elongate to close the floating element. But sometimes we need this automatic closure behavior, how to deal with it?
One way to do t
css| Advanced | tutorials | Web page
CSS pseudo elements are used to add special effects to some selectors.
CSS pseudo Element (pseudo-elements) instance:
Make a first letter effect
This example shows how to add a special effect to the first letter of the text.
can use The:first-letter pseudo-element to add a special effect to the
One of the most efficient CSS writing is to use shorthand. You can make your CSS file smaller and easier to read by shorthand. and understanding CSS attributes shorthand is also one of the basic skills of front-end development engineers. Today we systematically summarize the abbreviations for CSS properties.
Color abb
css| Advanced | tutorials
The CSS positioning property allows you to position elements.
CSS positioning (positioning) instance:
positioning: Relative positioning
This example shows how to position an element relative to its normal position.
positioning: Absolute positioning
This example shows how to use absolute values to locate an element.
to set the shape of
The CSS background properties define the background effects of an element.The background attribute of CSS can define background effects for elements.Set background color Set the background colorThis example demonstrates how to set the background color for an element.Instance: The code is as follows:Copy code Body {background-color: yellow}H1 {background-color: #00ff00}H2 {background-color: transparent}P
Grouping GroupWhen many selectors have the same properties, you can combine them with commas.Example:
The code is as follows
Copy Code
H2 {color:red;}. thisotherclass {color:red;}. yetanotherclass {color:red;}
The above can be written like this:
The code is as follows
Copy Code
H2,. Thisotherclass,. Yetanotherclass{color:red;}
Nesting nestingIf the CSS structure is good, you
Use
CSSCome
Location pageThe position of the inner layer has always been difficult to grasp. In many cases, elements that are usually absolutely located always take the top left corner of the browser as the coordinate origin. At this time, if the browser size changes, the defined layer will deviate from the desired position, making people scratching their heads.
In fact, to control the absolute positioning of the layer, you only need to understand the positioning in
complex tables into more manageable parts.
3.col and Colgroup
Row and column headings should use the TH tag instead of TD, but if some content is both title and data, it still uses TD. Table headings can be set to the scope property of row or col, defining whether they are row headings or column headings.
Although the TR element enables a developer to apply a style across a row, it is difficult to apply a style to the entire column. To solve this problem, the Colgroup and Col elements are i
We know the syntax of CSS in the first two chapters, but to show the effect in the browser, let the browser recognize and invoke it. When a browser reads a style sheet, it is read in text format, which describes four ways to insert a style sheet on a page: a link to an external style sheet, an inner style sheet, an imported outer style sheet, and an inline style.Linking to an external style sheetLinking to an external style sheet is to save the styles
This article mainly introduces the CSS selector grouping related data, the need for friends can refer to the following
Selector grouping
Suppose you want H2 elements and paragraphs to be gray. The easiest way to achieve this is to use the following statement:
h2, p {color:gray;}
A rule is defined by placing the H2 and P selectors on the left side of the rule and separating them with commas. Its right-hand style (color:gray;) is applied to the element
Body {Font-size: 0.8em;Color: Navy;}The above indicates setting the font-size font size and color font color for the body selector.
So basically, when it works with an HTML page, the text color between the body tag (content in the entire window) is Navy and the font size is 0.8ems.
Length and percentage
There are many attribute values in CSS to specify units, but some basic units are used in some attributes. Before that, they are worth attributes.E
CSS Bootstrap: simple application of tooltips, css tutorial1.For a common Element, first add an atip class in the class and add the corresponding value.Data-toggle unchangeable data-placement can be set to top | bottom | left | right | auto. title is not empty, the title is displayed; otherwise, the data-original-title is displayed.2. Of course, the most basic files must be imported.Then write a JS script.
A Pseudo class (pseudoclasses) is a bolt of a selector that specifies the state of a selector that is or is related to it. They are in the form of selector:pseudoclass{property:value;, simply separating the selectors and pseudo classes with a half-width English colon (:). Many of the suggestions for CSS are not supported by browsers, but there are four of them that can be used securely on connections. link is used on connections that are accessed.
The previous section describes the functions of CSS for creating web pages.The syntax for declaring CSS styles is as follows:Selector {selector {Adequacy: Set Value; property: set value;...}In a Selector, there is no limit on the number of parameter values that can be set. In a Selector, there is no limit on the number of attributes that can be set.There are three main types of selector: Type selector, Clas
Some CSS attributes allow a string of values to replace many attributes. Values are separated by spaces.Margin, pdding, and border-width can be merged into margin-top-width, margin-right-width, margin-bottom-width, and so on, in the form of property: top right bottom left; it is in a counter-clockwise order.So the following: The code is as follows:Copy code P {Border-top-width: 1px;Border-right-width: 5px;Border-bottom-width: 10px;Border-left-widt
When using the Div+css layout, you should first structure the content of the Web page, carefully analyze and plan your page structure, and you might get a few pieces like this:Page-level containers, page headers, flags and site names, site navigation (main menu), master content, submenus, search boxes, footers (copyright and related legal notices).You typically use DIV elements to define these structures, like this:This is not a layout, it is a struct
Defining IDs in XHTML, Classs are all used, mainly the aspect CSS defines the style to be able to wear at a glance. So, CSS naming is for reference only.
(1) Page structure class
Container: Container
Page Header: Header
Content: Content/container
Page body: Main
Page End: Footer
Navigation: Nav
Sidebar: Sidebar
Column: Column
Page perimeter control overall layout width: Wrapper
(2) Navigation cla
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.