Learn web development css初步

CSS 表示Cascading Style Sheets

CSS Basics takes you through what you need to get started.

Lke HTML, CSS is not really a programming language, it is not a markup language either - it is a style sheet language.that is, it lets you apply styles selectively to elments in HTML documents.

select all the paragraph elements on an HTML on page and turn the text within them red, you'd write this CSS.

p {
    color: red;
}

Selector
The HTML element name at the start of the rule set. It selects the element(s) to be styled (in this case, p elements). To style a different element, just change the selector.
Declaration
A single rule like color: red; specifying which of the element's properties you want to style.
Properties
Ways in which you can style a given HTML element. (In this case, color is a property of the p elements.) In CSS, you choose which properties you want to affect in your rule.
Property value
To the right of the property, after the colon, we have the property value, to choose one out of many possible appearances for a given property (there are many color values besides red).
p {
  color: red;
  width: 500px;
  border: 1px solid black;
}

选择多个元素

p,li,h1 {
  color: red;
}

它提供的css文件格式

html {
  font-size: 10px;
  font-family: 'Open Sans', sans-serif;
}


h1 {
  font-size: 60px;
  text-align: center;
}

p, li {
  font-size: 16px;  
  line-height: 2;
  letter-spacing: 1px;
}


html {
  background-color: #00539F;
}

body {
  width: 600px;
  margin: 0 auto;
  background-color: #FF9500;
  padding: 0 20px 20px 20px;
  border: 5px solid black;
}

h1 {
  margin: 0;
  padding: 20px 0;  
  color: #00539F;
  text-shadow: 3px 3px 1px black;
}

img {
  display: block;
  margin: 0 auto;
}

最终的显示效果。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值