gpt4 book ai didi

html - 仅将 CSS 混合模式应用于边框

转载 作者:行者123 更新时间:2023-11-28 15:42:23 25 4
gpt4 key购买 nike

我一直在做一个小网站,只是作为一个集成练习。但由于我对 CSS 没有深入的了解,所以我不知道最后是否可行:

我在网站上有一个表单,文本框被边框包围,我在 Photoshop 中应用了混合模式。想知道它是否存在于 CSS 中,我很快尝试了一下,但在尝试仅在边框上应用 mix-blend-mode 时遇到了困难。

有没有办法做到这一点,或者有一个选择器可以让我只到达边界而没有其他地方?

感谢您的回答!

最佳答案

更改 .border-gradientpadding 将更改 “border” 宽度。

.border-gradient {
padding: 4px;
background: #1e5799;
background: -moz-linear-gradient(-45deg, #1e5799 0%, #7db9e8 100%);
background: -webkit-linear-gradient(-45deg, #1e5799 0%,#7db9e8 100%);
background: linear-gradient(135deg, #1e5799 0%,#7db9e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=1 );
}
.border-gradient > .margin-fix {
background-color: white;
padding: 1px;
margin: -1px;
}
p {
padding: 0 1rem;
}
<div class="border-gradient">
<div class="margin-fix">
<p>[32] But I must explain to you how all this mistaken idea of denouncing of a pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?
<p>[33] On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.
</div>
</div>

请注意,创建跨浏览器的背景渐变并非易事。我建议使用在线工具,例如 this one - 不认可或推荐,如果您不喜欢,请寻找另一个 :)。

这是混合模式:

.blended {
padding: 20px;
background: red url('http://lorempixel.com/g/800/600/fashion') no-repeat 50% 50% /cover;
background-blend-mode: multiply;
}
.blended > .margin-fix {
background-color: white;
padding: 1px;
margin: -1px;
}
p {
padding: 0 1rem;
}
<div class="blended">
<div class="margin-fix">
<p>[32] But I must explain to you how all this mistaken idea of denouncing of a pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?
<p>[33] On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.
</div>
</div>

关于html - 仅将 CSS 混合模式应用于边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43297995/

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