gpt4 book ai didi

html - 如何制作背景图像 "shine through"文字的字母

转载 作者:搜寻专家 更新时间:2023-10-31 22:55:43 25 4
gpt4 key购买 nike

好的。我的标题可能没有让您充分了解我的问题到底是什么,但我真的不知道如何在标题中总结这个特定的问题。这是我的代码:

@import url('https://fonts.googleapis.com/css?family=Londrina+Sketch');
@import url('https://fonts.googleapis.com/css?family=Ranga');
@import url('https://fonts.googleapis.com/css?family=Rubik+Mono+One');
body {
background: url("http://wallpapercave.com/wp/X5iq6dZ.jpg");
}

header {
background: url(https://raw.github.com/mmoustafa/Chalkboard/master/img/bg.png);
color: white;
padding-top: 15px;
padding-left: 15px;
padding-right: 15px;
border-radius: 50px;
}

header h1 {
font-family: 'Londrina Sketch', cursive;
font-size: 2em;
margin-right: 50px;
}

header nav {
display: inline;
position: relative;
bottom: 50px;
left: 80%;
}

header nav a {
font-family: 'Ranga', cursive;
text-decoration: overline;
margin-right: 25px;
color: white;
font-size: 1.5em;
}

header nav a:hover {
text-decoration: none;
color: grey;
}

#section1 span {
color: transparent;
font-weight: 900;
font-family: 'Rubik Mono One', sans-serif;
display: inline-block;
background: white
}
<!DOCTYPE html>

<head>
<title>Nathaniel Santley | Welcome to my site!</title>
<link href="NathanielSantley.css" rel="stylesheet">
<meta charset="UTF-8">
<meta name="description" content="Hi! My name is Nathaniel Santley. I'm a programming enthusiast, video game lover, and a nerd down to the core.">
<meta name="keywords" content="nathaniel, santley, Nathaniel, Santley, programming, video, games">
<meta name="author" content="Nathaniel Santley">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>
<header>
<h1>Nathaniel Santley</h1>
<nav>
<a href="#">Home</a>
<a href="#">About Me</a>
<a href="#">Contact Me</a>
</nav>
</header>
<section id="section1">
<span><h1>NATHANIEL SANTLEY</h1><br /><h2>Programming enthusiast.<br />Video game lover.<br />Nerd down to the core.</h2></span>
</section>
<section>

</section>
<footer>

</footer>
</body>

我希望 #section1 span 具有白色背景,我希望图像通过 h1h2(不是白色背景),但我不知道该怎么做。

最佳答案

这里有一个解决方案。更改仅在最后两个 CSS 规则中:

@import url('https://fonts.googleapis.com/css?family=Londrina+Sketch');
@import url('https://fonts.googleapis.com/css?family=Ranga');
@import url('https://fonts.googleapis.com/css?family=Rubik+Mono+One');
body {
background: url("http://wallpapercave.com/wp/X5iq6dZ.jpg");
}
header {
background:
url(https://raw.github.com/mmoustafa/Chalkboard/master/img/bg.png);
color: white;
padding-top: 15px;
padding-left: 15px;
padding-right: 15px;
border-radius: 50px;
}
header h1 {
font-family: 'Londrina Sketch', cursive;
font-size: 2em;
margin-right: 50px;
}
header nav {
display: inline;
position: relative;
bottom: 50px;
left: 80%;
}
header nav a {
font-family: 'Ranga', cursive;
text-decoration: overline;
margin-right: 25px;
color: white;
font-size: 1.5em;
}
header nav a:hover {
text-decoration: none;
color: grey;
}
#section1 span {
font-weight: 900;
font-family: 'Rubik Mono One', sans-serif;
display: inline-block;
background: white
}
#section1 span h1, #section1 span h2 {
background: url(http://wallpapercave.com/wp/X5iq6dZ.jpg) -115px -95px no-repeat;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
<head>
<title>Nathaniel Santley | Welcome to my site!</title>
<link href="NathanielSantley.css" rel="stylesheet">
<meta charset="UTF-8">
<meta name="description" content="Hi! My name is Nathaniel Santley. I'm a programming enthusiast, video game lover, and a nerd down to the core.">
<meta name="keywords" content="nathaniel, santley, Nathaniel, Santley, programming, video, games">
<meta name="author" content="Nathaniel Santley">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<header>
<h1>Nathaniel Santley</h1>
<nav>
<a href="#">Home</a>
<a href="#">About Me</a>
<a href="#">Contact Me</a>
</nav>
</header>
<section id="section1">
<span><h1>NATHANIEL SANTLEY</h1><br /><h2>Programming enthusiast.<br />Video game lover.<br />Nerd down to the core.</h2></span>
</section>
<section>

</section>
<footer>

</footer>
</body>

顺便说一句:我从这里得到这个:https://css-tricks.com/image-under-text/

关于html - 如何制作背景图像 "shine through"文字的字母,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42742178/

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