background属性简写
background属性可以像margin padding属性一样,有简写方法,它的简写顺序是:
- background-color
- background-image
- background-repeat
- background-attachment
- background-position
如果某属性不想写,可以忽略。
下面的代码演示了background属性简写的用法。
<!DOCTYPE html><html> <head> <title>background简写</title> <style type="text/css"> body { background: url("https://www.liyongzhen.com//docs/images/spring-flower.png") no-repeat center top; color: #665544; padding: 20px;} h1 { color: white;} </style> </head> <body> <h1>软件开发,成就梦想</h1> <p>我们能为中国‘996’程序员做些什么?怎样才能能引起西方媒体和政府的关注?</p> <p>在程序员圈子里颇有名气的代码托管平台GitHub上,有人发起了一个名为“996.ICU”的项目,意为“工作996,生病ICU”, “996”即许多企业的程序员工作状态,从上午9点干到晚上9点,每周工作6天。这一项目得到了大量程序员的响应,自从3月26日注册以来, 截至4月2日Star数已突破15万整数关口,表示至少有15万名程序员关注了这个项目。</p> </body></html>