html - 缩小时渐变宽度增加?

标签 html css

我创建了一个使用线性渐变的 div。当我缩小(和/或放大)我的渐变收缩和增长取决于我缩小或放大的程度,我设置一个特定的宽度来试图阻止它。它没有用。

body{
  background: linear-gradient(200deg,#aebcbf -10%,#6e7774 110%,#0a0809 1000%);
  background-repeat:no-repeat
}

img {
  animation-name: rotate;
  animation-iteration-count: infinite;
  animation-duration:1s;
  animation-direction: reverse;
  animation-timing-function: ease-in;
  animation-play-state: playing;
  float: left;
  opacity:0.5;
  border-radius:90%;
}

h1{
  font-size:20px;
  font-family: monospace;
  font-variant-caps:titling-caps;
  text-align:center;
  text-decoration-style: wavy;
  text-shadow: 2px 2px #FFFFFF;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

#css-gradient {
  background: linear-gradient(blue, white);
  width:47%;
  border-style:outset;
  background-repeat:no-repeat
}
<div id="css-gradient">
  <img src="http://i.imgur.com/gQioYac.png" draggable="false">
  <img src="http://i.imgur.com/gQioYac.png" draggable="false">
  <img src="http://i.imgur.com/gQioYac.png" draggable="false">
  <img src="http://i.imgur.com/gQioYac.png" draggable="false">
  <img src="http://i.imgur.com/gQioYac.png" draggable="false">
  <div style="clear: left;"></div>
  <input type=color style="width:15px;height:100px;position:absolute;left:635px;top:8px;height:125px">
  <h1 title="If successful this will be in a white box">Hover over me!</h1>
  <hr style="width:300px;position:relative;top:-5px;border-style:double">
</div>

这是一个 JSFiddle ( https://jsfiddle.net/ffksjqp2/1/ )

最佳答案

我不是很明白你的问题。你的意思是用你的浏览器放大/缩小吗? 无论如何,你可以用你的 css-gradient 类试试这个:

#css-gradient {
      background: linear-gradient(blue, white);
      background-attachment: fixed;
      width:47%;
      border-style:outset;
      background-repeat:no-repeat
    }

关于html - 缩小时渐变宽度增加?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34477714/

相关文章:

html - 图像映射始终不起作用

jQuery ui 对话框不在 ASP.NET MVC 3 应用程序中使用 site.css

javascript - 使所选元素(内容框)变暗/着色并添加复选标记图标 AngularJS

html - 将 IFrame 的高度设置为 100% 不会导致它扩展以填充页面吗?

javascript - main.css 文件未加载

javascript - 如何在初始页面加载之前加载 CSS 数据主题以防止主题之间闪烁?

javascript - 使用 JavaScript 在 td 中水平切换效果

html - fixed div on mobile 不固定

javascript - 隐藏拖动预览 - HTML 拖放

html - 将 Div 排列成字母