HTML/CSS/CSS Controls/Seach box

Материал из Web эксперт
Версия от 08:16, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Adding search to the header

 
<!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>
<title>Adding search to the header</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
#wrapper {
  text-align: left;
  border: 1px solid #033;
  position: relative;
  font-size: 1.4em;
}
#header {
  background: #033;
  color: #fff;
  height: 55px;
  position: relative;
}
#header h1,#header h2 {
  position: absolute;
  padding: 0;
  margin: 0;
}
#header h1 {
  top: 5px;
  left: 8px;
  height: 50px;
  background: red;
}
#header h2 {
  top: 20px;
  left: 193px;
}
#headerlinks {
  float: right;
  font-size: 0.8em;
  background: gold;
  padding: 6px 6px 8px 10px;
}
#headerlinks a:link,#headerlinks a:visited,#headerlinks a:hover,#headerlinks a:active{
  color: #fff;
}
#headersearch form {
  padding: 0;
  margin: 0;
}
#headersearch {
  position: absolute;
  top: 2em;
  right: 5px;
}
#headersearch form input {
  padding: 0;
  margin: 0;
  vertical-align: middle;
}
#txtSearch {
  height: 17px;
  width: 115px;
  border: 1px solid black;
}
</style>
</head>
<body id="cols3">
<div id="wrapper">
 <div id="header">
 <h2>Header 2</h2>
 <div id="headerlinks">
     <a href="">Contact Us</a> | 
     <a href="">Site Map</a> | 
     <a href="">Store Locator</a></div>
 <div id="headersearch">
     <form>
         <input type="text" name="txtSearch" id="txtSearch" /> 
         <input type="button" alt="Search" /></form></div>
 </div>
</div>
</body>
</html>



Seach box floating right

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title></title>
<style type="text/css" media="Screen">

#title {
  float: left;
  min-width: 280px;
  max-width: 350px;
  margin-left: 0;
  background: pink;
}
#search {
  float: right;
  min-width: 280px;
  max-width: 350px;
  margin-right: 0;
  background:red;
}
</style>
</head>
<body>
    <h1 id="title">left</h1> 
    <div id="search"> 
        <form method="post" action=""> 
            <input type="text" value="" name="searchtext" id="searchtext" size="32" /> 
            <input type="submit" value="Search" name="find" id="find" /></form> 
        
        
    </div> 
</body>
</html>