第七部分——news

简要介绍:

本部分利用<article>标签实现了一种卡片式效果。

页面效果:

HTML代码:

   <section id="news"><div class="container"><div class="align"><i class="icon-pencil-circled"></i></div><h1>Our Blog</h1><div class="row"><div class="post"><img class="img-news" src="img/blog_img-01.jpg" alt=""/>                <div class="inside"><div class="timer"><p class="post-date"><i class="icon-calendar"></i>March 17, 2013</p></div><h2>A girl running on a road</h2><div class="entry-content"><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. &hellip;</p><a href="#" class="more-link">read more</a></div></div></div><article class="post"><img class="img-news" src="img/blog_img-02.jpg" alt=""/>                <div class="inside"><div class="timer"><p class="post-date"><i class="icon-calendar"></i>February 28, 2013</p></div><h2>A bear sleeping on a tree</h2><div class="entry-content"><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. &hellip;</p><a href="#" class="more-link">read more</a></div></div></article><article class="post"><img class="img-news" src="img/blog_img-03.jpg" alt=""/>                <div class="inside"><div class="timer"><p class="post-date"><i class="icon-calendar"></i>February 06, 2013</p></div><h2>A Panda playing with his baby</h2><div class="entry-content"><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. &hellip;</p><a href="#" class="more-link">read more</a></div></div></article></div><div id="a"><a href="#" class="btn btn-large">Go to our blog</a> </div></div></div></section>

CSS代码:

       #news{background: url("img/grey-cardboard-bg.png") repeat 0 0;padding: 0 70px;margin-top: 120px;margin-bottom: 100px;}#news .align{font-size: 6em;text-align: center;}#news h1{font-size: 3em;margin: 0.5em 0 1em 0;text-align: center;font-family: 'Patua One',cursive;}#news h2{font-size: 21px;margin-top: 24px;font-family: 'Patua One',cursive;font-weight: lighter;}#news .post{background: none repeat scroll 0 0 rgba(255,255,255,0.7);border-bottom-left-radius: 6px;border-bottom-right-radius:6px;display: inline-block;width: 31%;margin: 0 9px;box-shadow: 0 1px 6px rgba(0,0,0,0.1);-moz-box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);-webkit-box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);}#news img{margin: 0 auto;width: 100%;  /*宽度为父元素的100%*/}#news .inside{margin: 5px 24px 50px;padding-top: 0.3em;background: url("img/dot-row-2.png") repeat-x scroll 0 0 transparent !important;}#news .timer{margin-bottom: 5px;margin-top: 5px;float: right;width: 100%;}#news .post-date{color: #a5a5a2;float: right;font-family: 'Open Sans';font-size: 14px;font-style: normal;line-height: 2;}#news .more-link{float: left;            /*内容在父元素中从右往左排列*/text-decoration: none;  /*去除链接的下划线*/text-transform: uppercase;/*控制文本大小写,uppercase表示文本中每个单词都是大写字母*/font-family: 'Patua One', cursive;font-size: 0.9em;color:#f0bf00;margin: 12px 0 25px 0;}#news .more-link:hover{text-decoration: underline;}#news .btn-large{padding: 20px 30px;background:#f0bf00;      color: #fff; font-size: 19px;font-family: 'Patua One',cursive;letter-spacing: 0.05em;  /*字母间距*/ font-weight: bold;text-decoration: none;border-radius: 3px;   }#news .btn-large:hover{background: #43413e !important;}#news #a{text-align: center;margin-top: 100px;}

总结:

本部分遇到两个问题:

1、图片的宽度会超过其父元素的宽度。

2、时间戳会和h2在同一行,使得h2不够宽度放置会变成两行。

解决:

1、设置图片的宽度为100%,表示它会铺满父元素的区域,根据父元素的大小调整自己的大小。

2、给实践戳添加一个<div>父元素,设置div的样式为width:100%;float:right;

转载于:https://www.cnblogs.com/209yin/p/7602353.html

HTML+CSS页面练习——legend第七部分相关推荐

  1. HTML+CSS页面练习——legend第九部分

    第九部分--Contact And Footer 简要介绍: 本部分包括两个板块.一个用<form>元素实现的联系页面,另一个是页脚. 页面效果: Contact: Footer: HTM ...

  2. HTML+CSS页面练习——legend第五部分

    第五部分--Service 简要介绍: 页面效果: HTML代码: <section id="services"><div class="contain ...

  3. css屏幕大小的容器,位置2箭头固定到CSS页面容器的外部 - 屏幕大小

    我想创建一个HTML页面滑块,所以我有我的容器div,然后坐在外面,在左边我有一个Previous图标和右侧我有一个下一个图标.位置2箭头固定到CSS页面容器的外部 - 屏幕大小 我的问题是,当我将窗 ...

  4. div css 登录页面布局,DIV+CSS页面布局

    页面布局设计 一.三行模式或三列模式 特点:把整个页面水平.垂直分成三个区域. 三行模式:将页面分成头部.主体及页脚三部分 三列模式:将页面分成左.中.右三个部分 在CSS文件里: 1.三行模式代码 ...

  5. 网页显示不全的原因css,css 页面显示不全怎么办

    css页面显示不全的解决办法:1.取消css中对象的高度css样式:2.减少内容:3.在设置高度和宽度的同时再设置"overflow:hidden"属性样式. 本教程操作环境:wi ...

  6. html 网页 简体中文 繁体中文 英文自适应,css页面字体替换源代码和页面显示不一样问题解决...

    2018年8月27日19:58:12 css指定字体的时候,可以自制的字体,比如字符替换,比如 0没有被替换,其他在源代码被替换对应的字母,但是现实的时候在替换成正确的数字 很简单,防爬虫,但是... ...

  7. 符合SEO标准的div+css页面参考

    下面的部分是著名设计师阿捷发表的div+css三行两列网页参考,星箭在此基础上做了小小的改动,以前乐思蜀也对阿捷的这个经典布局案例进行过修改,将左右代码互换,达到主体内容显示在前更方便搜索引擎抓取分析 ...

  8. 常见的CSS页面布局方式

    详情:CSS页面结构是我们日常生活中最常使用到的,当然目前可能大家用的最多的是elementUI实现布局,简单方柏霓,下面介绍几种常见的原生页面布局的方式 公共的样式部分 <style>* ...

  9. php项目css加载失败,CSS页面加载失败的原因有哪些

    CSS加载失败的常见原因有:路径错误.浏览器不兼容.网络原因.编码格式不同等错误 才刚刚入门CSS,经常会碰到CSS加载失败的问题,网页上什么样式都没有,今天将要和大家分享的是常见的CSS加载失败的原 ...

最新文章

  1. Kali Linux安装谷歌浏览器
  2. 关于Android 中 一个错误的解决办法 “Do not request Window.FEATURE_ACTION_BAR.....
  3. 10个非常有用的CSS hack和技术
  4. 8. Action过滤
  5. php form validator 下单,PHP Form表单验证:PHP form validator使_php
  6. java CMS gc解析
  7. HDU2149 Public Sale【巴什博弈】
  8. 用Python网络爬虫来抓取网易云音乐歌词
  9. 网络管理工具IP-Tools的使用
  10. 《圣经》放射光明,金钱散发温暖
  11. 禅道、码云、coding、redmine、jira、teambition几大敏捷开发项目管理系统试用对比体验
  12. 思迅商云8版的最后一个版本_泪目!科比成为2K21第3位封面球星,将推出曼巴永恒版...
  13. Mycat的概述及部署安装
  14. java中Excel导出echart图片
  15. 计算机网络故障的排除,网络故障怎么排除 网络故障排除方法
  16. 李峋同款爱心代码(附源码,前端代码,python代码)
  17. form提交--jquery.form.js
  18. 【计算机视觉处理5】阈值处理
  19. 【#不求人】天空盒模型制作
  20. zookeeper的zoo.cfg配置文件详解

热门文章

  1. linux 常用正则表达式,Linux中基本正则表达式
  2. pads 文本不能修改_修改PDF文件很难?其实很简单,只是你少了一个好用的PDF编辑器...
  3. cmd 日志刷新卡屏
  4. java.lang.UnsupportedOperationException: null at java.util.AbstractList.add(AbstractList.java:148)
  5. Docker中常用的命令
  6. yum安装软件提示Another app is currently holding the yum lock
  7. 阿里安全体系获国际顶会表彰,安全技术将有九大新趋势
  8. 2016.05.07华为网盘-将会暂停服务的网站一览 - 做好数据迁移的准备哦
  9. Js屏蔽键盘输入的某些字符,用以部分代替正则表达式
  10. Facebook 的 PHP 性能与扩展性