一,效果图。

二,代码。

<!DOCTYPE html>
<html> <head>
<meta charset="utf-8">
<title>CSS id和class选择器</title>
<style>
#para1 {
text-align: center;
color: red;
} .center {
text-align: center;
} p.center {
text-align: right;
}
</style>
</head> <body>
<p id="para1">hello</p>
<p>this paragraph is not affected by the style.</p>
<h1 class="center">标题居中</h1>
<p class="center">段落居中</p>
</body> </html>

参考资料:《菜鸟教程》

最新文章

  1. Spring MVC重定向和转发及异常处理
  2. (四)新建Maven项目
  3. python下编译py成pyc和pyo
  4. Odoo Graph 指定默认 类型
  5. 批处理ODBC配置
  6. mysql存储过程性能监控和分析
  7. iOS开发UIScrollView的底层实现
  8. SQL语句查找重复记录
  9. MVC权限模块
  10. shiro中CacheManager相关的类结构介绍,提供redis Cache实现
  11. iOS 数组问题
  12. Centos 6.5 安装和使用docker
  13. idea 集成sonarLint检查代码bugs
  14. centos6.7环境之kvm虚拟化quem工具配置及使用详解
  15. 维护keepalived与mysql漂移脚本
  16. java中六个时间类的使用和区别
  17. 国家代号(CountryCode)与区号
  18. Java基础-逻辑运算符Logic Operators
  19. 使用Python的turtle(海龟)模块画图
  20. SharePoint 2013 EventHanlder工具

热门文章

  1. Android 音视频开发(六): MediaCodec API 详解
  2. java前后分离使用fetch上传文件失败500
  3. Python爬虫4-URLError与HTTPError
  4. 2种不同方式实现背景图里加入文字的简单CSS样式
  5. [Swift]LeetCode67. 二进制求和 | Add Binary
  6. [Swift]LeetCode637. 二叉树的层平均值 | Average of Levels in Binary Tree
  7. 非对称加密技术中,iFace [ 爱妃链 ]人脸密钥技术排名第三,将弥补区块链现有不足
  8. angularJS学习(二)
  9. 关于ML.NET v0.7的发布说明
  10. 软件性能测试技术树(三)----数据库(MySQL)性能