<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Document</title>
<style type="text/css">
*{margin: 0;padding: 0;}
div{width: 33.3%;float: left;background: red;font-size: 0;border-radius: 100%;position: relative}
div::before{content: "";padding-top: 100%;display: block;}
div span{color: #FFf;font-size: 14px;width: 100%;display: inline-block;text-align: center;top: 50%;position: absolute;height: 30px;line-height: 30px;margin-top: -15px;}
</style>
</head>
<body>
<div><span>哈哈</span></div>
<div><span>哈哈</span></div>
<div><span>哈哈</span></div>
</body>
</html>

转载于:http://www.cnblogs.com/sure2016/p/6340332.html

宽度设置百分比 高度跟宽度一样css解决方案的更多相关文章

  1. CSS图片宽度设置百分比 , 高度同宽度相同

    在图片长宽不相等的情况下,想将长宽设置为相等并且自适应屏幕,可以通过 js 的方式进行设置并通过监听 resize 来实时更新,但是这种方式很麻烦. 这里通过 css 来达到我们想要的效果: < ...

  2. 纯css设置元素高度与宽度相等

    设置图片高度等于宽度 .img-box{ width:100%; height:0; position: relative; padding-bottom: 100% } .img-box img{ ...

  3. [Android Pro] listView和GridView的item设置的高度和宽度不起作用

    referece to : http://blog.csdn.net/beibeixiao/article/details/9032569 1.     在Android开发中会发现,有时listVi ...

  4. ## GridView 布局:item设置的高度和宽度不起作用、自动适配列数、添加Header和Footer ##

    一.item设置的高度和宽度不起作用 转自:http://www.cnblogs.com/0616--ataozhijia/p/6031875.html [Android Pro] listView和 ...

  5. HTML给div设置百分比高度无效的解决方式 - 库塔姆斯 - CSDN博客

    原文:HTML给div设置百分比高度无效的解决方式 - 库塔姆斯 - CSDN博客 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/HobHunter ...

  6. css设置div高度与宽度相等的一种方法

    div.category{ width:33%; padding:33% 0 0; } 1.关键在padding:33% 0 0这句代码,通过设置padding-top与宽度相等(padding使用百 ...

  7. get新技能: 如何设置元素高度与宽度成特定比例。宽度改变,高度自动按比例改变。 例如设置宽高比16:9。

    设置宽高比在很多时候是有用的. 下面的栗子,我们设置一个容器的宽高比为16:9 //HTML代码片段 <div class="container"> <div c ...

  8. 【笔记】css 实现宽度自适应屏幕 高度自适应宽度

    如果说宽高自适应屏幕尺寸那么大家可能会想到 div{ width: 100%; height: 100% } 但是如果我要自适应屏幕尺寸的同时还要变成正方形呢?(高度和宽度相等而高度不能写死) 那就要 ...

  9. Element el-table-column组件列宽度设置百分比无效

    问题 使用Element table组件时,给列设置百分比宽度无效(width="30%") 解决 用属性min-width="3"代替属性width=&quo ...

随机推荐

  1. cordova 实现拨打电话-只需两步(H5)

    cordova 实现拨打电话: 第一步配置conf.xml在cordova中所有的URL Schemes 都是服从于白名单的,所以a tel 在这无法正常使用.解决方法是在项目config.xml中添 ...

  2. PYTHON调用C接口(基于Ctypes)实现stein算法最大公约数的计算

    相关环境配置 mingw,选择相应的32位.64位的版本,主要用于编译动态链接库dll文件,可用vs替代,这里我选择轻量级的mingw windows64位地址:https://sourceforge ...

  3. Linux PPTP拨号

    试验环境:Linux marsboard 3.4.90 #9 SMP PREEMPT Thu Mar 3 18:28:43 CST 2016 armv7l armv7l armv7l GNU/Linu ...

  4. 反向ssh

    参考 https://www.thegeekstuff.com/2013/11/reverse-ssh-tunnel/ https://www.howtoforge.com/reverse-ssh-t ...

  5. mysql密码过期的修改方法(your password has expired)

    今天打开SQLyog提示密码过期:Your password has expired 解决方法:    1.  启动MySQL服务 2.  启动MySQL后台 3.  执行以下命令 step 1: S ...

  6. hdu-1542 Atlantis(离散化+线段树+扫描线算法)

    题目链接: Atlantis Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others) ...

  7. NO1:在Windows端安装SecureCRT来连接Linux

    正常情况下都不会直接在Linux服务端进行操作,实际使用服务器和工作电脑不会在同一个地方,也不允许在服务器操作. 我这里用SecureCRT 7.0来连接服务器.提供个下载,带注册机工具: http: ...

  8. About getByClass

    不能获取class为多个的情况 function getByClass(parent,cls){ var res=[]; var ele=parent.getElementsByTagName(&qu ...

  9. linux 下文件恢复工具extundelete介绍

        下载 http://extundelete.sourceforge.net/ bunzip2 extundelete-0.2.0.tar.bz2 tar xvf extundelete-0.2 ...

  10. 九 Vue学习 manager页面布局

    1:  登录后系统页面如下: 对应代码: <template> <div class="manage_page fillcontain"> <el-r ...