gpt4 book ai didi

css - 更改 CCS 色带代码/样式

转载 作者:太空宇宙 更新时间:2023-11-04 08:22:24 25 4
gpt4 key购买 nike

我正在尝试使用此功能区代码(在某些生成器站点上找到)包含链接

我认为它看起来不错,但它不适合我需要在其中显示的长文本行(前总统)。

这是我第一次尝试使用 CSS 色带效果..我似乎无法理解参数会使它移动的内容(向左一些)..并使其显示时间更长我想要显示的较长文本。

  • 它是一个右侧对齐的功能区(为了清楚起见)..需要向左移动一点..并使其“更长”以显示更长的文本。

这是我的代码:

/* CSS ribbon styles */
/* http://www.cssportal.com/css-ribbon-generator/ */

.ribbon {
position: absolute;
right: -5px; top: -5px;
z-index: 1;
overflow: hidden;
width: 75px; height: 75px;
text-align: right;
}
.ribbon span {
font-size: 10px;
font-weight: bold;
font-size:10px;
color: #FFF;
text-transform: uppercase;
text-align: center;
line-height: 20px;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
width: 100px;
display: block;
background: #79A70A;
background: linear-gradient(#2989d8 0%, #1e5799 100%);
box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
position: absolute;
top: 19px; right: -21px;
}
.ribbon span::before {
content: "";
position: absolute; left: 0px; top: 100%;
z-index: -1;
border-left: 3px solid #1e5799;
border-right: 3px solid transparent;
border-bottom: 3px solid transparent;
border-top: 3px solid #1e5799;
}
.ribbon span::after {
content: "";
position: absolute; right: 0px; top: 100%;
z-index: -1;
border-left: 3px solid transparent;
border-right: 3px solid #1e5799;
border-bottom: 3px solid transparent;
border-top: 3px solid #1e5799;
}

虽然我使用这些更新的样式使它更大一些..

  • 字体看起来有点“简陋”
  • 既然我已经调整了其他样式,我似乎无法调整前后效果。

更新:

.ribbon {
position: absolute;
right: -5px; top: -5px;
z-index: 1;
overflow: hidden;
width: 275px;
height: 275px;
text-align: right;
}

/* new bigger attempt */
.ribbon span {
background: rgba(0, 0, 0, 0) linear-gradient(#2989d8 0%, #1e5799 100%) repeat scroll 0 0;
box-shadow: 0 3px 10px -5px rgb(0, 0, 0);
color: #fff;
display: block;
font-size: 10px;
font-weight: bold;
line-height: 20px;
position: absolute;
right: -85px;
text-align: center;
text-transform: uppercase;
top: 32px;
transform: rotate(45deg);
width: 250px;
}

最佳答案

试试这个。我更新了 .ribbon 上的宽度/高度/顶部/左侧和 .ribbon 跨度上的顶部/右侧。

.box {
width: 200px;
height: 200px;
background: gainsboro;
position: relative;
}


/* CSS ribbon styles */


/* http://www.cssportal.com/css-ribbon-generator/ */

.ribbon {
position: absolute;
right: -6px;
top: -5px;
z-index: 1;
overflow: hidden;
width: 115px;
height: 115px;
text-align: right;
}

.ribbon span {
font-weight: bold;
font-size: 10px;
color: #FFF;
text-transform: uppercase;
text-align: center;
line-height: 20px;
transform: rotate(45deg);
-webkit-transform: rotate(45deg);
width: 125px;
display: block;
background: linear-gradient(#2989d8 0%, #1e5799 100%);
box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
position: absolute;
top: 28px;
right: -24px;
}

.ribbon span::before {
content: "";
position: absolute;
left: 0px;
top: 100%;
z-index: -1;
border-left: 3px solid #1e5799;
border-right: 3px solid transparent;
border-bottom: 3px solid transparent;
border-top: 3px solid #1e5799;
}

.ribbon span::after {
content: "";
position: absolute;
right: 0px;
top: 100%;
z-index: -1;
border-left: 3px solid transparent;
border-right: 3px solid #1e5799;
border-bottom: 3px solid transparent;
border-top: 3px solid #1e5799;
}
<div class="box">
<div class="ribbon"><span>PAST PRESIDENT</span></div>
</div>

关于css - 更改 CCS 色带代码/样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45444149/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com