gpt4 book ai didi

html - 双背景图像

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

这次我希望我能够更好地格式化问题,如果后者微不足道,我深表歉意,但我是 html 和 css 的初学者。我需要标题方面的帮助,它需要如图所示:made of a background image cut into two halves by a white bar where the navigation bar(right) and the title (left) stand. The title has another background image shaped as a half-moon.由于我找不到一种可接受的方法使半月显示为我放置标题的 div 的背景图像,我制作了另一个以半月作为背景图像的 div,我给这个 div a相对位置,在顶部、右侧和左侧工作,使其适合正确的位置。但是,我不知道如何让文本显示在所有内容的前面。另外,如果我缩小浏览器窗口,半月形会在页面周围移动。我可以做些什么来让事情变得更好吗?

我的尝试如下。在此先感谢您的帮助。

html, body *{margin: 0; box-sizing: border-box}

h1, h2, h3, h4, h5 {
font-family: 'Play', sans-serif;
color: #c76161;
}

#header {
background: url("http://i65.tinypic.com/t8vzp2.jpg") 100% no-repeat;
background-position: center center;
position: fixed;
right: 0;
left: 0;
top:0;
display: block;
width: 100%;
height: 14.37em;

}

#testo-header{
background-color: white;
height: 70px;
width: 50%;
position: absolute;
top: 80px;
left: 0;
text-align: center;
line-height: 70px;
z-index: 2;
}

#mezzaluna{
background-image: url(http://i63.tinypic.com/w72ag6.png);
background-repeat: no-repeat;
height:90px;
position: relative;
bottom: 67px;
left: 180px;
z-index: 1;
}
ul#nav {
background-color: white;
height: 70px;
width: 50%;
position: absolute;
top: 80px;
right: 0;
font-family: sans-serif;
font-size: 1em;
font-weight: bold;
list-style-type: none;
line-height: 35px;
display: block;
}

ul#nav li {
float: left;
text-align: center;
vertical-align: text-top;
padding: 20px;

}

ul#nav li a {
text-decoration: none;
color: #3a7777;
}

ul#nav a:hover {
color: #f5af33

}
bodybody>
<div id="header">
<div class="wrap">
<div id="testo-header">
<h1>Rosso Pomodoro</h1>
<div id="mezzaluna"></div>
</div>
<ul id="nav">
<li><a href="#">Home</a></li>
<li class="active"><a href="#">Ricette</a></li>
<li><a href="#">Categorie</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contatti</a></li></li>
</ul>
</div>

最佳答案

不确定您打算用它做什么,但您可以这样做。如果您告诉我们您希望得到什么,那就更好了!但到目前为止,这就是您要尝试做的事情!

html, body *{margin: 0; box-sizing: border-box}

h1, h2, h3, h4, h5 {
font-family: 'Play', sans-serif;
color: #c76161;
}

#header {
background: url("http://i65.tinypic.com/t8vzp2.jpg") 100% no-repeat;
background-position: center center;
position: fixed;
right: 0;
left: 0;
top:0;
display: block;
width: 100%;
height: 14.37em;

}

#testo-header{
background-color: white;
height: 70px;
width: 50%;
position: absolute;
top: 80px;
left: 0;
text-align: center;
line-height: 70px;
z-index: 2;
}
#testo-header h1:before{
content: '\0020';
background-image: url(http://i63.tinypic.com/w72ag6.png);
background-repeat: no-repeat;
background-color: #ff0000;
width: 75%;
height:100%;
display: block;
position: absolute;
top: 50%;
left: 12.5%;


border-bottom-left-radius: 50%;
border-bottom-right-radius: 50%;

z-index: -1;
}

ul#nav {
background-color: white;
height: 70px;
width: 50%;
position: absolute;
top: 80px;
right: 0;
font-family: sans-serif;
font-size: 1em;
font-weight: bold;
list-style-type: none;
line-height: 35px;
display: block;
z-index: 5;
}

ul#nav li {
float: left;
text-align: center;
vertical-align: text-top;
padding: 20px;

}

ul#nav li a {
text-decoration: none;
color: #3a7777;
}

ul#nav a:hover {
color: #f5af33

}
bodybody>
<div id="header">
<div class="wrap">
<div id="testo-header">
<h1>Rosso Pomodoro</h1>
</div>
<ul id="nav">
<li><a href="#">Home</a></li>
<li class="active"><a href="#">Ricette</a></li>
<li><a href="#">Categorie</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Contatti</a></li></li>
</ul>
</div>

关于html - 双背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43948144/

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