ul li 定制圆点,list-style-image调整图片圆点大小 与 文字和图片排版
来源:互联网 发布:淘宝买家旺旺提取 编辑:程序博客网 时间:2024/05/22 03:19
今天我们要介绍两种前端要用到的布局:第一种是ul li定制化圆点的样式,然后使其与文字居中排列,另外一种是文字与图片混排并居中排版。
我们在使用ul li中通常会定制化圆点,使用如下代码就可以使圆点为自己设定的图片,然后调整圆点的对齐的像素
ul li{ list-style-type:none; background:url("img/ui.png") no-repeat 0rem 0.3rem; background-size:0.8rem 0.8rem; }
我们在使用rem作为计量单位的时候在head标签需添加一些声明:
<meta content='yes' name='apple-mobile-web-app-capable'> <meta content='yes' name='apple-touch-fullscreen'> <meta name='theme-color' content='#91D4DA'> <meta name='viewport' content='initial-scale=1, minimum-scale=1, user-scalable=no'>
这样我们就可以适配移动设备了。 效果图:
另外当我们遇到文字和图片排版,这一直需要不断地去调试,例如我们想实现这样一个效果:
我们可以使用span标签来规定文字的样式,使用一个div来包裹span和img标签,然后使用居中对齐的样式margin:0 auto就可以了,具体代码如下:
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"/><meta content='yes' name='apple-mobile-web-app-capable'> <meta content='yes' name='apple-touch-fullscreen'> <meta name='theme-color' content='#91D4DA'> <meta name='viewport' content='initial-scale=1, minimum-scale=1, user-scalable=no'><title>game</title><style type="text/css"> html{ font-size:62.5%; width:100%; height:100%; } body{ margin: 0 auto; font-family: 'Helvetica Neue', Helvetica, STHeiTi, sans-serif; background-color:#f4f4f4; padding:0; font-size:1.4rem; } footer{ background-color:#CDCDCD; } p2{ font-size:1.6rem; color:#000000; font-weight:bold; line-height:2rem; } .footerContent{ padding:1rem; margin:0 auto; height:4rem; width:24rem; background-color:#CDCDCD; } </style></head><body><footer> <div class="footerContent"> <span style="display: block;float: left"> <p2>欲了解更多王冠一教授相关资讯,</p2><br/> <p2>请关注 “冠一学堂” 微信公众号。</p2> </span> <span style="display: block; float: left"> <img src="wechat.png" style="vertical-align: middle;width:3.5rem;height:3.5rem;padding:0.1rem"/> </span> </div></footer></body></html>
阅读全文
0 0
- ul li 定制圆点,list-style-image调整图片圆点大小 与 文字和图片排版
- list-style-image图片背景与文字对齐准则
- HTML5 ul li 去前面的圆点 和 横排
- ul li与图片排列
- 图片和文字排版
- ul li设置横排,并除去li前的圆点
- ul li设置横排,并除去li前的圆点
- ul li设置横排,并除去li前的圆点
- ul li设置横排,并除去li前的圆点
- css取消无序列表<ul>点用list-style:none;
- Ul、Li的list-style-type 属性
- Ul、Li的list-style-type 属性
- Ul、Li的list-style-type 属性
- 让 list-style-image 图片垂直居中
- list-style-image 图片垂直居中
- ul、li显示图片标记
- ul和li编写的新闻图片展播
- Ul li排版使用
- Win10 打开PLSql,其他软件卡到爆,原因CnPlugin_1.5.4插件的问题
- 我为什么喜欢AI音箱?
- Java 9 新特性快速预览
- 怎样在Linux中,手动添加可执行程序,到所有系统菜单?
- LeetCode 3 Longest Substring Without Repeating Characters
- ul li 定制圆点,list-style-image调整图片圆点大小 与 文字和图片排版
- 使用eclipse构建Maven项目--web工程完整示例
- 对象成员的引用
- Spring框架IOC和AOP的理解
- a += a-= a*a
- 机器人于商业落地,技术再次创造奇迹
- android studio 注释模板并设置快捷键
- springboot+maven pom文件保错问题
- 使用configobj 来访问配置文件