标签:fonts nec depend rest svg splay its pie selected
@media
at-rule content is applied only if the device which runs the browser matches the expressed condition;@supports
at-rule content is applied only if the browser actually supports the tested feature;@document
at-rule content is applied only if the current page matches some conditions.*
) is the ultimate joker. It allows selecting all elements in a page.
These attribute selectors try to match an exact attribute value:
[attr]
: This selector will select all elements with the attribute attr
, whatever its value.[attr=val]
: This selector will select all elements with the attribute attr
, but only if its value is val
.[attr~=val]
: This selector will select all elements with the attribute attr
, but only if the value val
is one of a space-separated list of values contained in attr
‘s value, for example a single class in a space-separated list of classes.[attr|=val]
: This selector will select all elements with the attribute attr
for which the value is exactly val
or starts with val-
(careful, the dash here isn‘t a mistake, this is to handle language codes.)[attr^=val]
: This selector will select all elements with the attribute attr
for which the value starts with val
.[attr$=val]
: This selector will select all elements with the attribute attr
for which the value ends with val
.[attr*=val]
: This selector will select all elements with the attribute attr
for which the value contains the string val
(unlike [attr~=val]
, this selector doesn‘t treat spaces as value separators but as part of the attribute value.)Combinators | Select |
---|---|
AB | Any element matching both A and B at the same time. |
A B | Any element matching B that is a descendant of an element matching A (that is: a child, or a child of a child, etc.) |
A > B | Any element matching B that is a direct child of an element matching A. |
A + B | Any element matching B that is the next sibling of an element matching A (that is: the next child of the same parent.) |
A ~ B | Any element matching B that is among the next sibling of an element matching A (that is: one of the next children of the same parent.) |
!important
.!important
. Adding this to the end of a property value will give it superpowers.But really, don‘t use it if you can avoid it. Because !important
changes the way the cascade normally works, it can make debugging CSS problems really hard to work out, especially in a large stylesheet.
px: pixel size
em: ?em = ?*parent element size, i.e. font-size of <p> is 10px, then the <span> with the font-size of 1.4em will be 14px.
rem: ?rem = ?*root element size, i.e. font-size of <html> is 10px, then the <li> or <span> inside the <html> tags whose font-size is 1.4em will be 14px, no matter the size of its parent element.
font-style
: Used to turn italic text on and off. Possible values are as follows (you‘ll rarely use this, unless you want to turn some italic styling off for some reason):normal
: Sets text to normal font (turns existing italics off.)italic
: Sets text to use the italic version of the font if available; if not available, it will simulate italics with oblique instead.oblique
: Sets text to use a simulated version of an italic font, created by slanting the normal version.font-weight
: Sets how bold the text is. This has many available values available in case you have many font variants available (such as -light, -normal, -bold, -extrabold, -black, etc.), but realistically you‘ll rarely use any of them except for normal
and bold
:normal
, bold
: Normal and bold font weightlighter
, bolder
: Sets the current element‘s boldness to be one step lighter or heavier than its parent element‘s boldness.100
–900
: Numeric boldness values that provide finer grained control than the above keywords, if needed. text-transform
: Allows you to set your font to be transformed. Values include:none
: Prevents any transformation.uppercase
: Transforms ALL TEXT TO CAPITALS.lowercase
: Transforms all text to lower case.capitalize
: Transforms all words to Have The First Letter Capitalized.full-width
: Transforms all glyphs to be written inside a fixed-width square, similar to a monospace font, allowing aligning of e.g. latin characters along with asian language glyphs (like Chinese, Japanese, Korean.)text-decoration
: Sets/unsets text decorations on fonts (you‘ll mainly use this to unset the default underline on links when styling them.) Available values are:none
: Unsets any text decorations already present.underline
: Underlines the text.overline
: Gives the text an overline.line-through
: Puts a text-shadow: 4px 4px 5px red;
black
.text-align
property is used to control how text is aligned within its containing content box. The available values are as follows, and work in pretty much the same way as they do in a regular word processor application:left
: Left justifies the text.right
: Right justifies the text.center
: Centers the text.line-height
property sets the height of each line of text — this can take most length and size units, but can also take a unitless value, which acts as a multiplier and is generally considered the best option — the font-size
is multiplied to get the line-height
. letter-spacing
and word-spacing
properties allow you to set the spacing between letters and words in your text. You won‘t use these very often, but might find use for them to get a certain look, or to improve the legibility of a particularly dense font. They can take most length and size units.font
. These are written in the following order: font-style
, font-variant
, font-weight
, font-stretch
, font-size
, line-height
, and font-family
.list-style-type
: Sets the type of bullets to use for the list, for example square or circle bullets for an unordered list, or numbers, letters or roman numerals for an ordered list.list-style-position
: Sets whether the bullets appear inside the list items, or outside them before the start of each item.ol {
list-style-type: upper-roman;
list-style-position: inside;//outside
}
list-style-image
: Allows you to use a custom image for the bullet, rather than a simple square or circle.ul {
list-style-image: url(star.svg);
}
The start
attribute allows you to start the list counting from a number other than 1.reversed
attribute will start the list counting down instead of up.<ol start=“4" reversed>
<li>Toast pitta, leave to cool, then slice down the edge.</li>
<li>Fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li>
<li>Wash and chop the salad.</li>
<li>Fill pitta with salad, humous, and fried halloumi.</li>
</ol>
The value
attribute allows you to set your list items to specific numerical values. <ol>
<li value="2">Toast pitta, leave to cool, then slice down the edge.</li>
<li value="4">Fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li>
<li value="6">Wash and chop the salad.</li>
<li value="8">Fill pitta with salad, humous, and fried halloumi.</li>
</ol>
:link
pseudo class.:visited
pseudo class.:hover
pseudo class.HTMLElement.focus()
) — this is styled using the :focus
pseudo class.:active
pseudo class.a {
}
a:link {
}
a:visited {
}
a:focus {
}
a:hover {
}
a:active {
}
顺序很重要: lvfha<div class="one"></div>
<div class="two"></div>
html {
font-family: sans-serif;
background: #ccc;
}
.one, .two {
background: red;
width: 300px;
height: 150px;
padding: 20px;
border: 10px solid black;
margin: 20px auto;
}
.two {
box-sizing: border-box;
}
var one = document.querySelector(‘.one‘);
var two = document.querySelector(‘.two‘);
function outputWH(box) {
var width = box.offsetWidth;
var height = box.offsetHeight;
box.textContent = ‘Width: ‘ + width + ‘px, Height: ‘ + height + ‘px.‘
}
outputWH(one);
outputWH(two);
当你想生成一个border-box的时候(换言之,想生成一个以border作为box外边界、而非content的box的时候——所给他设置的padding和border被包含在box内部)https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_boxes/Box_model_recap标签:fonts nec depend rest svg splay its pie selected
原文地址:http://www.cnblogs.com/mintcat/p/6117217.html