css 空心圆
用css实现一个空心圆,并始终放置在浏览器窗口左下角
div{
position:fixed;
bottom:0;
left:0;
width:100px;
height:100px;
border:2px solid #000;
border-radius:100px;
}
如何让圆水平,垂直居中
div{
position:fixed;
top:50%;
left:50%;
transform:translate(-50%,-50%);
width:100px;
height:100px;
border:2px solid #000;
border-radius:100px;
}
IE7以下不支持position:fixed;的bug
1. 利用 Javascript 计算出需要的 top 值
<!--[if IE lt 7]>
<link rel="stylesheet" href="style.css" type="text/css" />
<![endif]-->
在style.css样式表中针对目标定位元素样式中写入:
position:absolute;
top:expression(eval(document.body.scrollTop + 50));
防止滚动条滚动时的闪动,需要定义HTMl的属性为:
html {
background-image: url(about: blank); /*用浏览器空白页面作为背景*/
background-attachment: fixed; /*确保滚动条滚动时,元素不闪动*/
}
在 IE 中特有的 CSS 运算符 expression中我们可以利用 Javascript 计算出需要的 top 值,这样就达到了与 position: fixed 同样的效果。
2.利用容器对溢出内容的处理方式来实现
定义body内外边距为0,实现html和浏览器窗口相同大小,使body出现滚动条,元素相对于html相对定位。
body { padding: 0; margin: 0; }
html { overflow: hidden; }
body { height: 100%; overflow: auto; }
针对IE6定义元素属性:
position: absolute;
top: 50% ;
left: 50% ;
margin-top: -140px;
margin-left: -168px;
让元素固定于浏览器
分别让元素定位于浏览器左侧、右侧、顶部、底部综合样式演示:
position:absolute;
bottom:auto;
top:expression(eval(document.documentElement.scrollTop));/* IE6 头部固定 */
position:absolute;
right:auto;
left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft, 10)0)-(parseInt(this.currentStyle.marginRight, 10)0));/* IE6 固定右侧 */
position:absolute;
bottom:auto;
top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop, 10)0)-(parseInt(this.currentStyle.marginBottom, 10)0)));/* IE6 固定底部 */
position:absolute;
right:auto;
left:expression(eval(document.documentElement.scrollLeft));/* IE6 左侧固定 */
css 空心圆的更多相关文章
- CSS空心圆
CSS代码:改变border的大小控制空心的大小 div { width: 100px; height: 100px; background: #ffffff; border-radius: 50%; ...
- 用css实现一个空心圆,并始终放置在浏览器窗口左下角
用css实现一个空心圆,并始终放置在浏览器窗口左下角 div{ position:fixed; bottom:0; ...
- Div+Css制作圆
Div+Css制作四分之一圆主要是使用Css3.0中的border-radius这个圆角隐藏属性.利用这一属性,我们可以画圆,画半圆,四分之三圆,四分之一圆等.以后我会更新…… 如何使用border- ...
- css画圆
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name ...
- android shap画圆(空心圆、实心圆)
实心圆: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android=" ...
- iOS空心圆下载进度指示器控件
self.layer = [CAShapeLayer layer]; self.layer.frame = CGRectMake(, , , ); self.layer.position = self ...
- android的布局 (如何实现空心圆效果的布局)
layer-list : 简单来说layer-list就是图层列表的意思,是用来创建LayerDrawable的,LayerDrawable是DrawableResource的一种,所以,layer- ...
- CSS知识总结(七)
CSS常用样式 5.背景样式 1)背景颜色 background-color : transparent | color 常用值:①英文单词,②十六进制,③RGB或RGBA 另外,还有一种是 渐变色彩 ...
- CSS 基础篇、绝对有你想要
本章内容: 简介 CSS 定义 四种引入方式 样式应用的顺序 选择器(Selector) * 通用元素选择器 标签选择器 class 类选择器 # ID选择器 , 多元素选择器 后代元素选择器 > ...
随机推荐
- [pytorch笔记] 调整网络学习率
1. 为网络的不同部分指定不同的学习率 class LeNet(t.nn.Module): def __init__(self): super(LeNet, self).__init__() self ...
- Apicloud_(问题)P54提示错误:Uncaught SyntaxError: Unexpected token ) at main.html : 117
<30天App开发从0到1:APICloud移动开发实战>第54页 打开main.html,在apiready中添加一段代码 api.addEventListener({ name: 'c ...
- LeetCode 43. 字符串相乘(Multiply Strings) 大数乘法
题目描述 给定两个以字符串形式表示的非负整数 num1 和 num2,返回 num1 和 num2 的乘积,它们的乘积也表示为字符串形式. 示例 1: 输入: num1 = "2" ...
- watir安装——windows环境
默认情况下,gem sources 都是https://rubygems.org/
- 使用OMF特性
Oracle 的OMF全称"Oracle managed file",关于这个概念的参考请自行查阅Oracle官方文档"Using Oracle-Managed File ...
- heigth innerheigt outerheight详解
height() :height innerHeight(): height + paddingouterHeight(): height + padding + border outerHeight ...
- 四、日志输出Reporter.log
一.Reporter.log import org.testng.Reporter; public class TestLog { public static void main(String[] a ...
- KahnProcessNetwork的Python实现
用Pytho实现了一个Kahn Process Network: 思路: 用Python的list模拟queue. 每个channel一个queue 用一个list (fgLog)来记录所有push到 ...
- ControlTemplate in WPF ——ScrollBar
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...
- nginx不记录指定文件类型的日志
1.指定记录文件日志记录的内容. vim /usr/local/nginx/conf/nginx.conf如下部分: log_format dd '$remote_addr $http_x_forwa ...