gpt4 book ai didi

css - 如何在 Logo 旁边的标题菜单中插入搜索栏。请告诉我我做错了什么?

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

您好,我是这个网站的新手,也是一般编程的新手。我目前正在尝试整理这个网站(只是练习),但我似乎被卡住了,我无法将搜索栏向上移动到 Logo 旁边。我知道我的菜单项也不正确,我会在解决此搜索栏问题后重试。我目前必须打开一个 index.html 和一个 style.css

这是下面的 html.index 页面。


<!doctype html>
<html>
<head>
<title>FindFriends</title>
<link rel="stylesheet" type="text/css" href="./css/style.css" />
</head>
<body>
<div class="headerMenu">
<div id="wrapper">
<div class="logo">
<img src="./img/find_friends_logo.png"/>
</div>
</div class="search_box" />
<form action="search.php" method="GET" id="search">
<input type="text" name="q" size="60" placeholder="Search."/>
</form>
</div>
<div id="menu">
<a href="#" />Home</a>
<a href="#" />About</a>
<a href="#" />Sign Up</a>
</div>
</div>
</div>
<div style="width: 800px; margin: 0px auto 0px auto;">
<table>
<tr>
<td width="60%" valign="top">
<h2>Join Find Friends Today</h2>
</td>
<td width="%" valign="top">
<h2>Sign Up Below</h2>
<form action="#" method="POST">
<input type="text" name="fname" size="25" placeholder="First Name" /><br /><br />
<input type="text" name="lname" size="25" placeholder="Last Name" /><br /><br />
<input type="text" name="username" size="25" placeholder="Username" /><br /><br />
<input type="text" name="email" size="25" placeholder="Email" /><br /><br />
<input type="text" name="email2" size="25" placeholder="Confirm Email" /><br /><br />
<input type="text" name="password" size="25" placeholder="Password" /><br /><br />
<input type="text" name="password2" size="25" placeholder="Confirm Password" /><br /><br />
<input type="submit" name="submit" value="Sign Up!" >
</form>
</td>
</tr>
</div>
</table>
</body>
</html>

下面是 style.css 页面。


* {
margin: 0px;
padding: 0px;
font-family: Arial, Helvetica, Sans-serif;
font-size: 12px;
background-color: #eff5f9;
}
.headerMenu {
background-image: url(../img/menu_bg.png);
height: 50px;
border-bottom: 0px;
padding-left: auto;
padding-right: auto;
width: 100%;
}
#wrapper {
background-image: url(../img/menu_bg.png);
margin-left: auto;
margin-right: auto;
width: 1000px;
padding-top: 0px;
padding-bottom: 0px;
}
.logo {
background-image: url(../img/menu_bg.png);
width: 125px;
}
.logo img {
background-image: url(../img/menu_bg.png);
width: 150px;
height: 38px;
padding-top: 5px;


}

.search-box {
background-image: url(../img/menu_bg.png);
position: absolute;
top: 13px;
margin-left: 135px;

}



#search input[type="text"] {
background: url(../img/search_dark.png) no-repeat 10px 6px #267bb6;
outline: none;
border: 0 none;
font: bold 12px Arial,Helvetica,Sans-serif;
width: 350px;
padding: 9px 15px 9px 35px;
margin: 0;
text-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
#search input[type="text"]:focus {
background: url(../img/search_light.png) no-repeat 10px 6px #fcfcfc;
color: #6a6f75;
width: 350px;
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.9) inset;
text-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}
@media screen and (max-width: 1280px) {
#menu {
background-image: url(../img/menu_bg.png);
position: absolute;
top: 0px;
right: 0px;
height: 37px;
padding-top: 19px;
margin-right: 2%;

}
}
@media screen and (min-width: 1280px) {
#menu {
background-image: url(../img/menu_bg.png);
position: absolute;
top: 0px;
right: 0px;
height: 37px;
padding-top: 18px;
margin-right: 3%;
}
}
@media screen and (max-width: 1920px) {
#menu {
background-image: url(../img/menu_bg.png);
position: absolute;
top: 0px;
right: 0px;
height: 37px;
padding-top: 15px;
margin-right: 4%;

}
}
#menu a {
color: #FFFFFF;
text-decoration: name;
font-size: 14px;
background-image: url(../img/menu_bg.png);
background-repeat: no-repeat;
padding-top: 19px;
padding-bottom: 22px;
padding-left: 10px;
padding-right: 10px;
}
#menu a:hover {

background-image: url(../img/menu_bg_hover_mouse_over.png);

}
h2 {
font-family: Arial, Helvetica, Sans-serif;
font-size: 18px;
padding: 8px;
color: #0084c6;
}
input[type="text"] {
background-color: #FFFFFF;
border: 1px solid #E2E2E2;
font-size: 15px;
padding: 5px;
width: 300px;
margin-bottom: 3px;
margin-top: 3px;
outline: none;
}
input[type="text"]:hover {
border: 1px solid #006fc4;
}
input[type="submit"] {
background-color: #006FC4;
border: 1px solid #00508D;
font-size: 15px;
color: #FFFFFF;
padding: 5px;
margin-bottom: 3px;
margin-top: 3px;
border-radius: 7px;
}

提前感谢您的帮助。

最佳答案

检查你在 html 和 css 中的类名,然后你应该在你的 Logo div 和搜索框 div 中使用 css float:left; 属性

关于css - 如何在 Logo 旁边的标题菜单中插入搜索栏。请告诉我我做错了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27395536/

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