<!DOCTYPE html>
<html>
<head>
<title>CSS01.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<style type="text/css">
*{
margin: 0px;
padding: 0px;
}
div{
width: 800px;
height:600px;
background-color: yellow;
}
#d1{
background-image: url(../pic/a.jpg);
background-repeat: no-repeat;/*不重复,就是不铺满啊*/
background-attachment:fixed;/*让图片固定,不要随着滚动条的滚动而出现图片的上下移动*/
}
</style>
</head>
<body>
测试
<div id="d1"></div>
</body>
<script type="text/javascript">
document.getElementById('d1').style['backgroundAttachment'] = 'scroll ';
document.getElementById('d1').style.backgroundImage = 'url(../pic/a.jpg)';
function $(id){return document.getElementById(id);}
$('d1').style.backgroundRepeat = 'no-repeat';
</script>
</html>
分享到:
相关推荐
前端开源库-css-background-videoCSS背景视频,一个支持背景视频作为CSS属性的HTML5填充程序
CSS中背景background-position负值定位 CSS中背景background-position负值定位 CSS中背景background-position负值定位 CSS中背景background-position负值定位 CSS中背景background-position负值定位
colorful-background-css-generator, 彩色css渐变 background 生成器 彩色css渐变 background-生成器用于创建彩色css背景的纯javascript生成器。检查这里网站查看生成器中的操作并使用颜色设置进行播放。它的思想是...
批量输出 CSS background-position 属性的定位像素值
PostCSS插件和微小的JS脚本(128字节)实现在CSS background中使用WebP
主要介绍了css3实现一个div设置多张背景图片及background-image属性,同时对于css3背景渐变也做了详细的解释,水平渐变,左上角渐变等等方式,需要的朋友可以参考下
css background之设置图片为背景技巧.docx
这篇文章将会涉及css背景(background)的基本用法,包括诸如 background-attachment 等的属性,也会介绍一些有关背景(background)的常用技巧,以及 css3 中的 背景(background)(包含4个新的背景(background)属性)。...
CSS3的background-size属性,实现响应式式图片等比例缩放。告别了考虑各种兼容性物理像素的烦恼。
最近在做项目的时候遇到一个问题,需要获取一个动态预览的图片的地址,这其实不是什么问题,主要是该图片的路径是写在css的background-img属性中的,于是决定要用js获取它的url中的内容,下面给大家分享解决的方法,...
背景backgroundcss说明background-image:url("图片的网址");背景图background:url("图片的网址");背景background-color:#色码;背景色彩Exp:background-image:url(背景图案.jpg,gif,bmp);background-color:#FFFFFF;...
CSS里的background-size属性能够让程序员决定如何在指定的元素里展示。MooTools程序员Christoph Pojer在他的网站上运用了background-size技术,使得在浏览器上他的头像始终“全面覆盖”在页头上——甚至是在手机上。...
NULL 博文链接:https://jslfl.iteye.com/blog/1137105
css background-position背景定位属性想必从事前端开发的朋友并不陌生吧,这个属性很实用的利用它可以实现很多的图片样式效果,下面是其具体的使用方法,感兴趣的朋友不要错过
在做下拉框select的时候用一个箭头符号,作为下拉框的三角,在firefox和chrome下均可以正常显示,但是在IE下无法显示。 查找了很久,发现是图片格式问题,把png格式的... background:url(images/arrow.gif) no-repeat 1
CSS的background属性的缩写,优点是比单个属性书写要简单,要少写很多代码。为了避免书写顺序上有些困扰,下面有个示例,大家可以参考下
css中padding、margin两个重要属性的详细介绍及举例说明
auroral, 带纯CSS的动画 background 渐变 极光- 动画 background-梯度极光是一组动画的background 渐变,几乎可以在任何地方使用。 它们是用纯CSS构建的。 为了了解它是如何工作的,阅读了文章。演示你可以测试所有...