background-image 相关问题

background-image CSS属性为元素设置一个或多个背景图像。

“background-size: cover;”有区别吗和“背景大小:覆盖,包含;”?

我使用的html编辑工具可以选择“background-size: cover;”和“背景大小:覆盖,包含;”分别地。 另外,我想知道两者之间是否有区别...

回答 1 投票 0

更改滚动上的固定背景图像

如标题中所述,我正在尝试更改滚动上的背景图像并轻松添加漂亮的过渡。 背景图像应该固定并保持在适当的位置。内容动人...

回答 1 投票 0

如何将CSS过滤器仅应用于背景图像[重复]

我有一个全屏快速滚动 HTML 页面,其中有不同的主题;您可以通过向下滚动来访问这些内容。 不同的类别有不同的背景图片

回答 2 投票 0

为什么带有百分比值的background-position不会移动背景?

我有一个元素,其背景图像设置为渐变,背景位置:80%;但背景位置根本不移动渐变。 你好 div { 回来...

回答 1 投票 0

背景大小:封面在 iOS 上不起作用

这是我的代码: 背景颜色:#fff; 背景附件:固定; 背景重复:不重复; 背景大小:封面; -moz-背景大小:封面; -webkit-background-size:覆盖; -o-背景-...

回答 9 投票 0

背景图像未显示在浏览器中

所以我尝试在标题中添加背景图像,当我从编辑器作为实时服务器打开 HTML 文件时,它工作正常,但是当我从浏览器正常打开文件时(没有...

回答 2 投票 0

将背景图片插入标题

我试图插入背景图像作为我的标题的背景。如果我使用背景颜色作为标题的背景,效果会很好 h2 { 背景颜色:红色; ...

回答 3 投票 0

为什么我的线性渐变转换为纯背景颜色?

我有一个简单的导航栏,我正在对其应用渐变,遵循 w3schools 上的示例(https://www.w3schools.com/css/css3_gradients.asp) .nav-bar { 背景图像:线性渐变(到 bo...

回答 1 投票 0

使用 CSS 停止背景重复

我在背景中设置了,并添加了关键帧来循环浏览图像。我的目标是使用这些来创建精益循环动画,但我无法阻止背景图像的重复... 我在背景中设置了 <li>,并添加了关键帧来循环浏览图像。我的目标是使用这些来创建精益循环动画,但我无法阻止背景图像重复。 有一张图像我无法控制,而下面的一张图像的大小和位置正确。 如有任何帮助,我们将不胜感激。 .cb-slideshow span { width: 100%; height: 100%; position: absolute; top: 0px; left: 0px; color: transparent; background-size:cover; background-position: 50% 50%; opacity: 0; z-index: 0; animation: imageAnimation 8s linear infinite 0s; background-repeat: no-repeat; } .cb-slideshow li:nth-child(1) span { background-image: url(../images/1.jpg) } .cb-slideshow li:nth-child(2) span { background-image: url(../images/2.jpg); animation-delay: 1s; } .cb-slideshow li:nth-child(3) span { background-image: url(../images/3.jpg); animation-delay: 2s; } .cb-slideshow li:nth-child(4) span { background-image: url(../images/4.jpg); animation-delay: 3s; } .cb-slideshow li:nth-child(5) span { background-image: url(../images/5.jpg); animation-delay: 4s; } .cb-slideshow li:nth-child(6) span { background-image: url(../images/6.jpg); animation-delay: 5s; } .cb-slideshow li:nth-child(7) span { background-image: url(../images/7.jpg); animation-delay: 6s; } .cb-slideshow li:nth-child(8) span { background-image: url(../images/8.jpg); animation-delay: 7s; } @keyframes imageAnimation { 0% { opacity: 0 } 0.1% { opacity: 1 } 12.5% { opacity: 1 } 12.6% { opacity: 0 } 100% { opacity: 0 } } .no-cssanimations .cb-slideshow li span{ opacity: 1; } <ul class="cb-slideshow"> <li> <span><img src="Images/1.jpg" ></span> </li> <li> <span><img src="Images/2.jpg" ></span> </li> <li> <span><img src="Images/3.jpg" ></span> </li> <li> <span><img src="Images/4.jpg" ></span> </li> <li> <span><img src="Images/5.jpg" ></span> </li> <li> <span><img src="Images/6.jpg" ></span> </li> <li> <span><img src="Images/7.jpg" ></span> </li> <li> <span><img src="Images/8.jpg" ></span> </li> </ul> 您可以使用CSS属性background-repeat: no-repeat;来防止图像重复。

回答 1 投票 0

给定这种图像,我怎样才能实现像CSS中那样的背景?

我刚刚学习HTML和CSS。所以,我得到了一个设计,但我不知道如何设计背景图像部分,因为有两个非常大的背景图像。这是设计 并使用

回答 1 投票 0

使用 CSS 计算 Chrome Android 上的视口高度

所以我注意到移动Chrome将地址栏计算到视口高度中。因此,在元素上使用 height: 100vh 不起作用,因为当地址栏滚动视口时

回答 3 投票 0

如何使用CSS来实现这个边框效果

第一: 资源背景图片 (PNG):https://i.imgur.com/pyYfyit.png (SVG):https://jmp.sh/s/emDkCSycZ7dfNoAOODAb 第二个效果(蓝色部分宽度不确定): 资源背景图片 ...

回答 1 投票 0

有办法为css中使用的图像设置默认目录吗?

我有一个 css 文件,出于组织原因,该文件位于图像所在的另一个目录中。问题是我总是最终像这样设置所有背景图像:background-ima...

回答 6 投票 0

如何制作这个背景

我正在 Bootstrap 5 中编写一个网站,但我不知道如何正确制作这个背景(https://postimg.cc/xJymRpVf)。有人能帮助我吗? 这是我的部分的代码。 我正在 Bootstrap 5 中编写一个网站,但我不知道如何正确制作这个背景(https://postimg.cc/xJymRpVf)。有人可以帮我吗? 这是我的部分的代码。 <section class="py-5"> <div class="container"> <div class="row justify-content-center"> <div class="col-lg-9 col-12 py-5"> <h2 class="fw-bold text-blue">Přidejte se mezi úspěšné franšízové sítě </h2> <p class="mt-4">Čekáte, až si Vás franšízanti sami najdou? Máme bohaté zkušenosti s akvizicí franšízantl pro úspěšné sítě a rozvíjíme také jejich obchodní strategii.</p> </div> </div> <div class="row justify-content-center"> <div class="col-lg-9 col-12 mb-3"> <p class="h4 fw-bold text-blue">Síť tradičního holičství na 15 místech</p> </div> </div> <div class="row justify-content-center"> <div class="col-lg-9 col-12"> <div class="row"> <div class="col-lg-6 col-12"> <img src="img/barber.jpg" class="img-fluid"> </div> <div class="col-lg-6 col-12"> <div class="card radius-bottom bg-primary p-4 text-white h-100 d-flex justify-content-center"> <p class="h5 fw-bold">Royal Barber & Shop</p> <ul class="small"> <li>Tvoříme obchodní strategii</li> <li>Hledáme motivované franšízanty</li> <li>Spuštěné on-line kampaně k propagaci</li> </ul> <p class="fw-bold">15 poboček, 1 000 zákazníků</p> </div> </div> </div> <div class="col-12 text-center mt-5"> <a href="#" class="btn btn-lg bg-success rounded-pill text-white fw-bold px-5">Pojďme spolupracovat</a> </div> </div> </div> </div> </section> 我不知道如何正确地做到这一点:/ 这是一个图像 如果您可以访问包含背景图像的网站,您可以从检查中获取它作为 URL 不幸的是,这是一个图形设计,我必须编码

回答 2 投票 0

有没有办法制作Safari专属的背景图片?

我的 Tumblr 博客现在使用带有背景附件的背景图像:fixed它在 Windows 和 Android 上完美运行但是,根据 caniuse.com(文章链接),此属性适用于...

回答 1 投票 0

SVG 圆圈中的背景图像,定位图像并将图像紧贴到圆圈中,尽管宽度/高度未知

<svg width="450" height="250"> <defs> <pattern id="image" patternUnits="userSpaceOnUse" height="100" width="100"> <image x="0" y="0" width="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/103536-934915.png"></image> </pattern> </defs> <circle id='top' cx="50" cy="50" r="49" stroke="black" fill="url(#image)"/> <defs> <pattern id="image2" patternUnits="userSpaceOnUse" height="100" width="100"> <image x="0" y="0" width="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/104201-933650.png"></image> </pattern> </defs> <circle id='top2' cx="175" cy="50" r="49" stroke="black" fill="url(#image2)"/> <defs> <pattern id="image3" patternUnits="userSpaceOnUse" height="100" width="100"> <image x="0" y="0" width="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/104041-1917730.png"></image> </pattern> </defs> <circle id='top3' cx="300" cy="50" r="49" stroke="black" fill="url(#image3)"/> </svg> 我们非常接近此处所需的输出,即玩家图像与 SVG 圆圈的背景图像紧密贴合。我们遇到最后两个问题: 似乎无法更改cx值。对于这里的第二个和第三个圆圈,如果我们将 cx 值更新为 150(而不是 175)和 250(而不是 300),则图像不再被截止。但是,我们希望图像之间有这个空间(一般来说,我们希望能够使用 cx 和 cy 根据需要定位所有圆圈。更改 x 元素上的 y、image 值不是有帮助。我们如何避免这种截止,同时保持 175、300 的 cx 值? 我们特意从 height 中删除了 images 元素,将宽度设置为等于圆直径以获得干净的结果。然而,在第三张图像中,图像的宽度小于其高度,导致底部出现 white-space 的问题。在这种情况下,我们似乎应该将 height 设置为 100 并保留宽度,但我们事先不知道图像尺寸。尽管不知道高度>宽度还是反之亦然,我们如何才能干净地让所有图像适合圆圈? 将您的patternUnits更改为objectBoundingBox并使用preserveAspectRatio来正确定位您的图像。如果源图像具有不同的宽高比,preserveAspectRatio 的切片选项将裁剪掉较短尺寸周围的任何空白。但是,您可能会发现,如果头部不在同一相对位置,则需要调整相对位置(yMin 或 yMid 或 yMax)。 <svg width="450" height="250"> <defs> <pattern id="image" patternUnits="userSpaceOnUse" height="100" width="100"> <image x="0" y="0" width="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/103536-934915.png" preserveAspectRatio="xMidYMax slice"></image> </pattern> </defs> <circle id='top' cx="50" cy="50" r="49" stroke="black" fill="url(#image)"/> <defs> <pattern id="image2" patternUnits="objectBoundingBox" height="100%" width="100%"> <image x="0" y="0" width="100" height="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/104201-933650.png" preserveAspectRatio="xMaxYMin slice"></image> </pattern> </defs> <circle id='top2' cx="175" cy="50" r="49" stroke="black" fill="url(#image2)"/> <defs> <pattern id="image3" patternUnits="objectBoundingBox" height="100%" width="100%"> <image x="0" y="0" width="100" height="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/104041-1917730.png" preserveAspectRatio="xMidYMin slice"></image> </pattern> </defs> <circle id='top3' cx="300" cy="50" r="49" stroke="black" fill="url(#image3)"/> </svg> 如果您的图像元素的宽度/高度=100,那么当它们位于 cx 和 cy 都等于 50 的圆内时,它们看起来会居中。 鉴于此,您只需要将它们翻译到您想要的位置即可。 您可以使用 viewBox 来修复第三个图像,但如果您想适应未知内容,则需要 javascript,即获取图像尺寸,然后根据需要创建适当的 viewBox。 顺便说一句,在 SVG 图像元素上指定 x="0" 和 y="0" 是多余的,因为这是默认值。我已经删除了这些属性。 <svg width="450" height="250"> <defs> <pattern id="image" patternUnits="userSpaceOnUse" height="100" width="100"> <image width="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/103536-934915.png"></image> </pattern> </defs> <circle id='top' cx="50" cy="50" r="49" stroke="black" fill="url(#image)"/> <defs> <pattern id="image2" patternUnits="userSpaceOnUse" height="100" width="100"> <image width="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/104201-933650.png"></image> </pattern> </defs> <circle id='top2' transform="translate(125, 0)" cx="50" cy="50" r="49" stroke="black" fill="url(#image2)"/> <defs> <pattern id="image3" patternUnits="userSpaceOnUse" height="100" width="100" viewBox="5 0 90 90"> <image width="100" xlink:href="https://storage.googleapis.com/cbb-image-files/PlayerHeadshots/104041-1917730.png"></image> </pattern> </defs> <circle id='top3' transform="translate(250, 0)" cx="50" cy="50" r="49" stroke="black" fill="url(#image3)"/> </svg> 为了不陷入 SVG-wants-unique-id-values 陷阱,您可以创建一个 Web 组件: customElements.define("svg-avatar", class extends HTMLElement { connectedCallback() { this.style.display = "inline-block"; let id = Math.floor(Math.random() * 1e6); let file = this.getAttribute("file"); let href = `https://octodex.github.com/images/` + file; let ratio = this.getAttribute("ratio") || "xMidYMin"; this.innerHTML = `<svg viewBox="0 0 100 100"> <defs> <pattern id="im${id}" patternUnits="objectBoundingBox" height="100%" width="100%"> <image width="100" height="100" href="${href}" preserveAspectRatio="${ratio} slice"/> </pattern> </defs> <circle cx="50" cy="50" r="49" stroke="black" fill="url(#im${id})"/>`; } }); svg-avatar { width: 180px; background: rebeccapurple; } <svg-avatar file="saint_nictocat.jpg"></svg-avatar> <svg-avatar file="grinchtocat.gif"></svg-avatar> <svg-avatar file="original.jpg"></svg-avatar>

回答 3 投票 0

flutter 启动画面问题总是先显示 flutter 启动画面,然后只有应用程序启动画面有效,使用了 flutter_native_splash 库但没有用

flutter 启动画面问题总是先显示 flutter 启动画面,然后只有应用程序启动画面可以工作,使用 flutter_native_splash 库,但没有使用我的启动画面包含带渐变的背景图像...

回答 1 投票 0

背景图像缩放。相应地改变尺寸

我正在制作一个网站,我想在背景中添加一个图像。但只是用它 背景图像使其粘在窗口的两侧,如果我要切换到手机,它......

回答 1 投票 0

自动调整非背景图像的大小以填充容器div

我正在尝试拉伸图像并用图像覆盖填充容器 div,以赋予其圆形效果。如果容器 div 高度大于图像,则会显示背景颜色。一个...

回答 3 投票 0

图像从浏览器视图中随机消失

我刚刚开始学习CSS,我需要你的帮助。 我开始编写代码,一切看起来都正确且漂亮,图像也就位。然后我停顿了20分钟,回到电脑前,眉头……

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.