这两天的CSS3学习笔记:
慕课网课程地址: http://www.imooc.com/learn/33
text-overflow:ellipsis;
overflow:hidden;
white-space:nowrap;
@font-face {
font-family : 字体名称;
src : 字体文件在服务器上的相对或绝对路径;
}
background-image:url1,url2,...,urlN;
background-repeat : repeat1,repeat2,...,repeatN;
backround-position : position1,position2,...,positionN;
background-size : size1,size2,...,sizeN;
background-attachment : attachment1,attachment2,...,attachmentN;
background-clip : clip1,clip2,...,clipN;
background-origin : origin1,origin2,...,originN;
background-color : color;
<a href="xxx.pdf">我链接的是PDF文件</a>
<a href="#" class="icon">我类名是icon</a>
<a href="#" title="我的title是more">我的title是more</a>
a[class^=icon]{
background: green;
color:#fff;
}
a[href$=pdf]{
background: orange;
color: #fff;
}
a[title*=more]{
background: blue;
color: #fff;
}
<h2><a href="#brand">Brand</a></h2>
<div class="menuSection" id="brand">
content for Brand
.menuSection{
display: none;
}
:target{/*这里的:target就是指id="brand"的div对象*/
display:block;
}
.wrapper > div:first-of-type {
background: orange;
}
div:hover {
-webkit-transform: scale(1.5,0.5);
-moz-transform:scale(1.5,0.5)
transform: scale(1.5,0.5);
}
a{
transition: background 0.8s ease-in 0.3,color 0.6s ease-out 0.3;
}
@keyframes changecolor{
0%{
background: red;
}
100%{
background: green;
}
}
.flexcontainer{
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
}
.flexcontainer{
-webkit-flex-direction: column;
flex-direction: column;
-webkit-justify-content: flex-start;
justify-content: flex-start;
}
.flexcontainer{
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row;
-webkit-align-items: flex-start;
align-items: flex-start;
}
.flexcontainer{
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row;
-webkit-justify-content: flex-start;
justify-content: flex-start;
}
.flexcontainer{
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-align-items: flex-start;
align-items: flex-start;
}
.flexcontainer{
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row;
-webkit-justify-content: flex-end;
justify-content: flex-end;
}
.flexcontainer{
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-align-items: flex-end;
align-items: flex-end;
}
.flexcontainer{
display: -webkit-flex;
display: flex;
-webkit-flex-direction: row;
flex-direction: row;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
}
.flexcontainer{
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-align-items: center;
align-items: center;
-webkit-justify-content: center;
justify-content: center;
}
.bigitem{
-webkit-flex:200; flex:200;
}
.smallitem{
-webkit-flex:100;
flex:100;
}
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<link rel="stylesheet" type="text/css" href="print.css" media="print" />
@importurl(reset.css) screen;
@importurl(print.css) print;
<head>
<style type="text/css">
@importurl(style.css) all;
</style>
</head>
@media screen {
选择器{
/*你的样式代码写在这里…*/
}
}
<head>
<style type="text/css">
@media screen{
选择器{
/*你的样式码写在这里…*/
}
}
</style>
</head>
@media screen and (max-width:480px){
.ads {
display:none;
}
}
@media screen and (min-width:900px){
.wrapper {
width: 980px;
}
}
@media screen and (min-width:600px) and (max-width:900px){
body {
background-color:#f5f5f5;
}
}
<link rel="stylesheet" media="screen and (max-device-width:480px)" href="iphone.css" />
@media not print and (max-width: 1200px){
样式代码
}
<linkrel="stylesheet" media="only screen and (max-device-width:240px)" href="android240.css" />
<linkrel="stylesheet" media="(min-width:701px) and (max-width:900px)" href="mediu.css" />
<linkrel="stylesheet" type="text/css" ref="style.css" media="handheld and (max-width:480px), screen and (min-width:960px)" />
img {max-width:100%;}
<img src="image.jpg" data-src-600px="image-600px.jpg" data-src-800px="image-800px.jpg" alt="" />
@media (min-device-width:600px){
img[data-src-600px]{
content: attr(data-src-600px,url);
}
}
@media (min-device-width:800px){
img[data-src-800px] {
content:attr(data-src-800px,url);
}
}
media-queries.js(http://code.google.com/p/css3-mediaqueries-js/)
respond.js(https://github.com/scottjehl/Respond)
<!—[if lt IE9]>
<scriptsrc=http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js></script>
?<![endif]>
1024px显屏
@media screen and (max-width : 1024px) {
/* 样式写在这里 */
}
800px显屏
@media screen and (max-width : 800px) {
/* 样式写在这里 */
}
640px显屏
@media screen and (max-width : 640px) {
/* 样式写在这*/
}
iPad横板显屏
@media screen and (max-device-width: 1024px) and (orientation: landscape) {
/* 样式写在这 */
}
iPad竖板显屏
@media screen and (max-device-width: 768px) and (orientation: portrait) {
/* 样式写在这 */
}
iPhone 和 Smartphones
@media screen and (min-device-width: 320px) and (min-device-width: 480px) {
/* 样式写在这 */
}
原文地址:http://blog.csdn.net/geyao2015/article/details/43907975