码迷,mamicode.com
首页 > Web开发 > 详细

CSS学习

时间:2016-03-28 23:21:16      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:

四月要开始搞个人博客网站,完全独立做,前端技术是第一个难关啊。

 

一,CSS文件的声明

在<head></head>中,同一目录的情况:<link rel = "stylesheet" type = "text/css" href = "myStyle.css"/>

二,元素选择器

<html>
       <head>
              <link rel = "stylesheet" type = "text/css" href = "myStyle.css"/>
              <title>
                     hello.html
              </title>
       </head>
       <body>
              <a>hhhhh</a>
              <b>lllll</b>
       </body>
</html>
a
{
   color:blue;
}
b
{
   color:red;
}

三,类选择器

注意,css里面,class前面要写一.

<html>
       <head>
              <link rel = "stylesheet" type = "text/css" href = "myStyle.css"/>
              <title>
                     hello.html
              </title>
       </head>
       <body>
              <a class = "class1">hhhhh</a>
              <b class = "class2">lllll</b>
       </body>
</html>
.class1
{
   color:blue;
}
.class2
{
   color:red;
}

 四,id选择器

前面#

<html>
       <head>
              <link rel = "stylesheet" type = "text/css" href = "myStyle.css"/>
              <title>
                     hello.html
              </title>
       </head>
       <body>
              <a id = "id1">hhhhh</a>
              <b id = "id2">lllll</b>
       </body>
</html>
#id1
{
   color:blue;
}
#id2
{
   color:red;
}

 

CSS学习

标签:

原文地址:http://www.cnblogs.com/rixiang/p/5331012.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!