gpt4 book ai didi

html - 如何创建这个菜单背景?

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

我有一个我应该转换为 HTML 页面的设计,有一个带有背景的菜单,它们之间有一点空间,请看图片,以便您了解我应该做什么。

http://i.imgur.com/KC3KqLA.png

我有什么(有点乱):

body, div, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, img, form, fieldset, input, blockquote {
margin: 0; padding: 0; border: 0;
}

body {
font-family: Helvetica, Arial, Sans-Serif; line-height: 24px;
background: #eee url(images/body-bg.jpg) center top no-repeat;
}

#container {
width: 80%; margin: 0 auto; height:1000px; margin-top: -75px; background-color: blue;
}

#destaques {
margin-top: 75px;
width:100%;
height: 100%;
background-color: grey;
}

#categories {
background-color: red;
position: absolute;
top: 80px; right: 25px;
}

#categories a {
margin: 0 4px;
font-size: 15px;
color: white;
text-decoration: none;
padding: 6px 20px;
}

#header {
overflow: hidden;
padding: 0 0 50px 0;
}

#mllcont {
height:200px;
background-color: grey;
}

#slidecont {
height: 650px;
background-color: red;
}

#squares {
width:100%;
height:250px;
}

#divs div {
height: 250px;
width: 20%;
border: 0px solid red;
margin-left: 2.5%;
margin-right: 2.5%;
float: left; /*Here you can also use display: inline-block instead of float:left*/
background: orange;
}

#header h1 {
float: left;
}


#content, #footer, #header {
height: 100%;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Particle</title>

<link href="styles.css" rel="stylesheet" type="text/css" media="screen" />

</head>

<body>

<div id="slidecont">

<div id="mllcont">

<div id="logo">
</div>

<div id="header">
<ul id="categories">
<a href="#">Menu1</a></li>
<a href="#">Menu2</a></li>
<a href="#">Menu3</a></li>
<a href="#">Menu4</a></li>
</ul>
</div>

<div id="languages">
</div>

</div>


</div>

<div id="container">

<div id="squares">
<div id="divs">
<div>One</div>
<div>Two</div>
<div>Three</div>
<div>Four</div>
</div>
</div>

<div id="destaques">


</div>

<div id="Projetos">

</div>

</div>

<div id="footer">
<ul id="credits">
<li><a href="http://wordpress.org" class="wordpress">Powered by WordPress</a></li>
<li><a href="http://www.blog.spoongraphics.co.uk" class="spoongraphics">Theme by SpoonGraphics</a></li>
</ul>
<p id="back-top"><a href="#header">Back to top</a></p>
</div>
</div>


</body>
</html>

最佳答案

代替

<ul id="categories">
<a href="#">Menu1</a></li>
<a href="#">Menu2</a></li>
<a href="#">Menu3</a></li>
<a href="#">Menu4</a></li>
</ul>

使用

<ul id="categories">
<li><a href="#">Menu1</a></li>
<li><a href="#">Menu2</a></li>
<li><a href="#">Menu3</a></li>
<li><a href="#">Menu4</a></li>
</ul>

背景菜单- http://www.colorzilla.com/gradient-editor/

body, div, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, img, form, fieldset, input, blockquote {
margin: 0;
padding: 0;
border: 0;
}
body {
font-family: Helvetica, Arial, Sans-Serif;
line-height: 24px;
background: #eee url(images/body-bg.jpg) center top no-repeat;
}
#container {
width: 80%;
margin: 0 auto;
height:1000px;
margin-top: -75px;
background-color: blue;
}
#categories {
list-style: none;
position: absolute;
top: 80px;
right: 25px;
font-size: 0;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#1b75b1+0,529282+47,71ac4a+100 */
background: rgb(27, 117, 177);
/* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;
base64, PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzFiNzViMSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjQ3JSIgc3RvcC1jb2xvcj0iIzUyOTI4MiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM3MWFjNGEiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(left, rgb(27, 117, 177) 0%, rgb(82, 146, 130) 47%, rgb(113, 172, 74) 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgb(27, 117, 177)), color-stop(47%, rgb(82, 146, 130)), color-stop(100%, rgb(113, 172, 74)));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, rgb(27, 117, 177) 0%, rgb(82, 146, 130) 47%, rgb(113, 172, 74) 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, rgb(27, 117, 177) 0%, rgb(82, 146, 130) 47%, rgb(113, 172, 74) 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(left, rgb(27, 117, 177) 0%, rgb(82, 146, 130) 47%, rgb(113, 172, 74) 100%);
/* IE10+ */
background: linear-gradient(to right, rgb(27, 117, 177) 0%, rgb(82, 146, 130) 47%, rgb(113, 172, 74) 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#1b75b1', endColorstr='#71ac4a', GradientType=1);
/* IE6-8 */
}
#categories li {
display: inline-block;
vertical-align: top;
position: relative;
}
#categories li a {
font-size: 15px;
color: white;
text-decoration: none;
padding: 6px 22px;
display: block;
}
#categories li:before{
content: '';
width: 1px;
height: 15px;
background: #fff;
position: absolute; top: 0; left: 0;
}
#categories li:first-child:before{
background: none;
}
<ul id="categories">
<li><a href="#">Menu1</a>
</li>
<li><a href="#">Menu2</a>
</li>
<li><a href="#">Menu3</a>
</li>
<li><a href="#">Menu4</a>
</li>
</ul>

关于html - 如何创建这个菜单背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31195032/

25 4 0