background-size

Table TR with background-size bug Safari

▼魔方 西西 提交于 2019-12-23 04:10:35
问题 Look at this fiddle, he will work different on safari and chrome: https://jsfiddle.net/sew120xt/1/ Desired look (chrome): https://i.stack.imgur.com/q9ABs.png Bugged look (safari): https://i.stack.imgur.com/Sc6YF.png Seems like Safari will treat the style for TR as a style for his childrens instead, is there a fix for that? 回答1: You seem to be correct that it is a bug. It isn't just the element <tr> itself but any element displayed as a table-row in a table displayed element. I've replicated

background-size transition on hover causes chrome to “shake” background image

ぃ、小莉子 提交于 2019-12-19 18:47:11
问题 I am trying to achieve an effect I saw recently, where background image zooms on hover. I pretty much did it with example here: https://jsfiddle.net/qyh6nbwt/ but it seems to be very shaky (you will understand what I mean by hovering over it), I'm on osx running latest chrome version, have not checked it in other browsers yet. Is there a way to make it smoother, so it doesn't "shake" on zoom in? HTML <div id="example"> test </div> CSS #example { background-image: url(http://www

background size cover IE11 not covering full area

守給你的承諾、 提交于 2019-12-19 11:35:27
问题 I'm going bonkers. IE11 refuses to fill the entire area of a DIV with a background image, even though I've set the background-size property to cover. Consider the following example: CSS: .bg { width: 100%; min-height: 220px; background: url("bg.jpg") center top no-repeat; background-attachment: fixed; background-size: cover; } HTML: <div class="bg">bla</div> <div class="bg">blabla<br />blabla</div> Chrome, Firefox, Safari, Opera all do what I expect to happen: the background image, bg.jpg, is

背景样式

徘徊边缘 提交于 2019-12-17 09:00:35
1. 什么是背景样式 背景样式是W3C规定的浏览器如何渲染元素的背景层,用户可以在背景层添加图片,颜色等效果 2. 背景颜色3种设置方式 (1)rgb模式:分别代表红绿蓝三种颜色,取值范围rgb(0,0,0)→rgb(255,255,255) (2)rgba模式:a的取值范围0~1, 代表透明度 (3)十六进制写法:取值范围 #000000~#ffffff 3. 背景颜色写法 background-color : red ; 4. 背景图片写法 background-image : url(./images/1.jpg) ; 5. 背景平铺 background-repeat: 初始值为repeat;(默认重复) 分解为两个值: background-repeat-x:repeat; background-repeat-y:repeat; 如果不需要背景图片重复显示: 样式值可设置为no-repeat; 重复 div { width : 200px ; height : 200px ; border : 1px solid red ; background-image : url(./images/123.png) ; background-size : 100px 100px ; /* background-repeat: no-repeat; */ } 不重复 div {

Background-size with SVG squished in IE9-10

坚强是说给别人听的谎言 提交于 2019-12-17 07:13:12
问题 I have a div set with a background image: <div>Play Video</div> with the following CSS: div { background-image: url('icon.png'); background-image: url('icon.svg'), none; background-size: 40px 40px; background-repeat: no-repeat; background-position: 90% 50%; padding: 20px; width: 150px; } The background size is respected in Firefox, Safari and Chrome. In IE8, the SVG is replaced by the PNG file. However, in IE9 and IE10, the SVG file is drastically sized down. The problem seems to be linked to

background-size 100%跟cover的区别

不羁的心 提交于 2019-12-16 11:07:42
background-size中,100%和cover都是用于将图片扩大或者缩放来适应整个容器 background-size:100% 100%;按容器比例撑满,图片变形; background-size:cover;把背景图片放大到适合元素容器的尺寸,图片比例不变,超出容器的部分可能会裁掉。 当为百分比的时候,100%和100%,100%也会显示不一样的效果: background-size:这个属性有两个值,第一个值为x轴方向的缩放比例或者px,第二个值为y轴方向的缩放比例或者px,如果只写一个值,则第二个值默认为auto(根据图片原来的比例,以及现有的宽度,来确定高度) 比方说:你有一张长宽比例为4:3的图片,有一个width:100px;height:50px;的盒子(也就是长宽比例为2:1)。 background-size:100% 100%;这种方式设置完背景图片的大小后,会完全铺满整个盒子,并且背景图片的比例会因此改变为2:1 background-size:100%;这种方式设置的背景图片的大小,x轴会和盒子一样的宽,但是y轴由于默认为auto,根据上面的理论计算得背景图片的高度为300px,但是盒子只有50px高,超出的部分隐藏,所以看两种写法的效果自然就不一样啦。 100% :你一定会看到完整的背景图片,但是有可能被挤压(失去图片原来的比例) 100%

CSS中背景图片background-size的相关设置

删除回忆录丶 提交于 2019-12-15 05:01:47
加载图片可以使用img标签或者背景图片的方式;一般是图片需要被搜索引擎和爬虫收录时使用img,其它的logo、小图片、banner图都,可以使用背景图片的方式加载。 当背景图片宽度大于div宽度时,可以设置background-size:100% 100%(宽度、高度都会充满); background-size的四种属性值: 1、background-size:length-------->设置背景图片高度和宽度。第一个值设置宽度,第二个值设置的高度。如果只给出一个值,第二个是设置为 auto(自动); 2、background-size: percentage--------> 将计算相对于背景定位区域的百分比。第一个值设置宽度,第二个值设置的高度。如果只给出一个值,第二个是设置为"auto(自动)",背景图片大于div时也可通过background-size:100% 100%,将图片完全放入div中,同时实现宽度和高度的自适应; 3、background-size:cover-------->保持图像的纵横比并将图像缩放成将完全覆盖背景定位区域的最小大小; 4、 background-size:contain--------> 保持 图像的 纵横比 并将图像缩放成将适合背景定位区域的最大大小; 来源: CSDN 作者: 无名老仙 链接: https://blog.csdn

Is there a way to preserve the quality of a background image when scaling upward?

空扰寡人 提交于 2019-12-13 21:40:12
问题 I'm currently trying to set the background image for this toy app I am working on. By looking around on SO, I saw the following code being recommended: body { background: url(../images/download.jpeg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } However the image quality still looks terrible on my desktop. The original dimensions of the image are 168px(h) and 300px(w). Any help is appreciated!

css3学习1

时光毁灭记忆、已成空白 提交于 2019-12-13 14:06:02
1。边框 转自 https://www.runoob.com/css3/css3-borders.html border-radius 圆角,例子 border-radius:25px border-shadow 盒阴影 ,例子 border-shadow:10px 10px 5px #888888; border-image 边界图片,例:border-image:url(border.png) 30 30 round; 2.背景 转自 https://www.runoob.com/css3/css3-backgrounds.html background-image 背景图片,例 {background-image:url(img_flwr.gif),url(paper.gif); background-position:right botton,left top; background-repeat:no-repeat,repeat; } 另可 { background: url ( img _ flwr . gif ) right bottom no-repeat , url ( paper . gif ) left top repeat ; } background-size 背景图片大小。例 background-size:80px 60px;配合backgroud

background-size transition doen't work in IE10/11

╄→尐↘猪︶ㄣ 提交于 2019-12-13 03:32:56
问题 What's wrong with this code? The zoom transition effect doesn't work in Internet Explorer 10 or 11 (OK in other browsers). <div class="image"></div> .image { width:300px; height:200px; background: url("http://lorempixel.com/300/200"); background-position:center; background-size:100%; transition: background-size 1s ease; -moz-transition: background-size 1s ease; -o-transition: background-size 1s ease; -webkit-transition: background-size 1s ease; } .image:hover { background-size:150%; }