响应标题与透明图标和纯色背景颜色

时间:2017-11-03 20:10:07

标签: css css3

我的左侧有一个带透明口音的标题栏。还有纯色背景色。我需要它以响应并接受任何长度的标题。 IDK为什么会这么痛苦,但我已经尝试了一切。

我尝试过将静态图像作为背景,但当标题为两行高时,没有骰子。

如果它是一个坚固的图标,那就很容易:只需放入图像并添加背景颜色即可。因为没有"透明图像"我胜过背景颜色,我迷失了。

这是最终产品需要的样子:

mockup

关于如何将透明度与纯色背景相结合并且没有所述背景填充透明度的任何想法?

更新:我目前的代码不是很好,但现在是。它适用于大多数宽度,但是当它变窄时就是一场灾难。我会尝试你的建议,让你知道事情是如何运作的。感谢大家!!!

HTML



.titlebox-wrap {
  width:90%;
  position:absolute;
  top:-2em;
  left:-3em;
  margin:0;
  padding:0;
}
.titlebox-hook {
  background: url("images/blue-cap.png") no-repeat;
  background-size:cover;
  background-position:left center;
  position:absolute;
  top:0;
  left:0;
  width:10%;
  height:100%;
  z-index:-1;
}
.titlebox-text {
  background:#0d2240;
  margin:0;
  margin-left:9.8%;
  padding:.7em 1em .7em 0;
  max-width:80%;
  float:left;
  -webkit-border-radius:.2em 3em 3em .2em; 
  -moz-border-radius:.2em 3em 3em .2em; 
  border-radius:.2em 3em 3em .2em;
}

<div class="titlebox-wrap">
  <div class="titlebox-hook"></div>
  <span class="titlebox-text">THIS STUPID THING NEEDS TO DICTATE LENGTH</span>
</div>
&#13;
&#13;
&#13;

4 个答案:

答案 0 :(得分:0)

  • 创建一个仅与透明切口部分一样宽的背景图像,但非常高,透明形状上方和下方有大的纯色区域 - 您必须决定此设计元素合理需要多少行文本以适应确定要生成的图像的px高度
  • 在伪元素上使用该bg图像
  • 将伪元素放在使用负margintransform: translateX()保存文本的元素之外,或者放在包装器的flexbox子元素的真实元素中

以下是使用flexbox(来自https://codepen.io/RwwL/pen/yPOade)的示例:

html, body {
  height: 100%;
}

body {
  padding: 5%;
  height: 100%;
  font-family: sans-serif;
  background: linear-gradient(to bottom, red, orange);
  background-size: cover;
  background-repeat: no-repeat;
}

.titlebox-wrap {
  width:90%;
  margin:0;
  padding:0;
  display: flex;
}
.titlebox-hook {
  width: 40px;
  background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAMgCAYAAADVw8ezAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAA6hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxNy0xMS0wM1QxNzoxMTo5MDwveG1wOk1vZGlmeURhdGU+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+UGl4ZWxtYXRvciAzLjc8L3htcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24+MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgICAgPHRpZmY6Q29tcHJlc3Npb24+NTwvdGlmZjpDb21wcmVzc2lvbj4KICAgICAgICAgPHRpZmY6UmVzb2x1dGlvblVuaXQ+MjwvdGlmZjpSZXNvbHV0aW9uVW5pdD4KICAgICAgICAgPHRpZmY6WVJlc29sdXRpb24+NzI8L3RpZmY6WVJlc29sdXRpb24+C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DEi6uNkDxARKnwFJFzd7gJhA6TMg6eJmDxATKH0GJF3c7AFiAqXPgKSLmz1ATKD0GZB0cbMHiAmUPgOSLm72ADGB0mdA0sXNHiAmUPoMSLq42QPEBEqfAUkXN3uAmEDpMyDp4mYPEBMofQYkXdzsAWICpc8bl/YupDfZe0CBhcXGi9efH0B5QKHgNy8MFhb/Az7FmlVpZmalAAAAAElFTkSuQmCC');
  background-repeat: no-repeat;
  background-position: left center;
}
.titlebox-text {
  background:#0d2240;
  flex: 1;
  color: #fff;
  padding :.7em 2em .7em 0;
  max-width:80%;
  float:left;
  -webkit-border-radius:.2em 3em 3em .2em; 
  -moz-border-radius:.2em 3em 3em .2em; 
  border-radius:.2em 3em 3em .2em;
}

这是一个示例,说明如何设置图像,使用半圆形打孔而不是花哨的花形,但它的工作方式相同:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAMgCAYAAADVw8ezAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAA6hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyIKICAgICAgICAgICAgeG1sbnM6ZXhpZj0iaHR0cDovL25zLmFkb2JlLmNvbS9leGlmLzEuMC8iPgogICAgICAgICA8eG1wOk1vZGlmeURhdGU+MjAxNy0xMS0wM1QxNzoxMTo5MDwve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yg9BmQdHGzB4gJlD4Dki5u9gAxgdJnQNLFzR4gJlD6DEi6uNkDxARKnwFJFzd7gJhA6TMg6eJmDxATKH0GJF3c7AFiAqXPgKSLmz1ATKD0GZB0cbMHiAmUPgOSLm72ADGB0mdA0sXNHiAmUPoMSLq42QPEBEqfAUkXN3uAmEDpMyDp4mYPEBMofQYkXdzsAWICpc+ApIubPUBMoPQZkHRxsweICZQ+A5IubvYAMYHSZ0DSxc0eICZQ+gxIurjZA8QESp8BSRc3e4CYQOkzIOniZg8QEyh9BiRd3OwBYgKlz4Cki5s9QEyg9BmQdHGzB4gJlD4Dki5u9gAxgdJnQNLFzR4gJlD6DEi6uNkDxARKnwFJFzd7gJhA6TMg6eJmDxATKH0GJF3c7AFiAqXPgKSLmz1ATKD0GZB0cbMHiAmUPgOSLm72ADGB0mdA0sXNHiAmUPoMSLq42QPEBEqfAUkXN3uAmEDpMyDp4mYPEBMofQYkXdzsAWICpc8bl/YupDfZe0CBhcXGi9efH0B5QKHgNy8MFhb/Az7FmlVpZmalAAAAAElFTkSuQmCC

答案 1 :(得分:0)

只是一个快速的想法(不保证它会起作用):为什么不尝试将装饰品的反转作为svg(可以设计颜色)的蓝色,其余的不是太复杂?

答案 2 :(得分:0)

最后用Flex完成了

HTML

<div class="fancy-title">
   <div class="fancy-cap"></div>
   <div class="fancy-text">content</div>
</div>

CSS

.fancy-title {
   display: flex;
   flex-direction: row;
   justify-content: flex-start;
   flex-wrap:nowrap;
   }
.fancy-cap {
    background: url("images/blue.png") no-repeat 0 0;
    background-size:cover;
    background-position:center left;
    width:2.7em;
    }
.fancy-text {
    background:#0d2240;
    width:auto;
    }

答案 3 :(得分:-2)

img {
Background: 100%;
background: url();
}



img {
width: 100%;
display: block;
}