搜索输入崩溃

时间:2014-02-18 23:41:04

标签: html5 css3 responsive-design blogs

我想在博客中搜索输入。我正在努力使博客响应,因此当用户调整浏览器大小时,我希望所有内容都折叠到一定的大小。实际上,我的侧边栏中的搜索表单输入没有崩溃,并且溢出了div和div。下面是我到目前为止的代码。在使这种响应方面我缺少什么?

 <div class="gridContainer clearfix">

 <!--HEADER--> 
<div id="LayoutDiv1">
        <div align="center">
          <!--NAVIGAIION + LOGO-->
  </div>
        <nav>
            <div class="header">

                     <div id="toplogo top" align="center"><a class="logo" href="#"></a>      </div>

<hr>    


                    <div align="center">
                      <!--navigation list items-->
                     <ul id="topmargin" class="navigation scaling">
          <li class="scaling"><a href="#"></a><img class= "invert"      src="home.png" width="160px" height="55px"></li>
          <li class="scaling"><a href="#"></a><img class="invert" src="about.png"></li>
          <li class="scaling"><a href="#"></a><img class="invert" src="contact.png"></li>
          <li class="scaling"><a href="#"></a><img class="invert" src="work.png"></li>
        </ul>

                      <hr>

                    </div>
            </div>
        </nav>
        <div align="center">
          <!--end of NAVIGATION + LOGO-->


  </div>
  <div id="LayoutDiv2" class="clearfix">

        <div id="content">            <p>This is the Content efnoifnegnrorfnoewnfdksncldncksdjcndlscnkdsncldksnclnsdl
          </p>   
        </div>


        <aside>

            <div id="sidebar">

              <div id="sidebar-content">

                <p> This is the Sidebar</p>

        <form  class=action="" id="search-form" method="get">

                <input type="text" value="search"   onblur="if(this.value=='')this.value='search'" onfocus="if(this.value=='search')this.value=''"/>

                <input type="hidden" value="submit"/>

          </form>

              </div>

          </div>

        </aside>






 </div><!--end of LayoutDiv2-->



   <div id="LayoutDiv3">
   <hr>

             <footer><!--beginning of FOOTER-->


                    <div class="footer">
                            <p>PETER</p>
                    </div>



 </footer> <!-- end of FOOTER-->

  </div>



   </div><!--end of LayoutDiv1-->





 </div>
 <p>&nbsp;</p>
 <!--end of Grid Container, HEADER, CONTENT, FOOTER-->


 And here is my CSS:

 img, object, embed, video {
max-width: 100%;
 }

 .ie6 img {
width:100%;
 }

 #topmargin{
margin-top: 5px;
margin-bottom: 5px;
 }

 form{
 padding:5px;
 word-wrap:break-word;

 }

 .logo{
background: url(PLUM%20monogram1.png);
display: block;
height: 100px;
margin-bottom: 10px;
margin-left: auto;
margin-right: auto;
text-align: center;
transition: all 500ms linear 0s;
width: 56px;
z-index: 2;
margin-top:5px;
}

 .logo:hover{
background-image: url(PLUM%20monogram2.png);
transition: all 300ms linear 0s;
margin-top:5px;

}

 #toplogo{
display:inline-block;
margin-top:10px;
height:100px;
}

 .navigation{
clear: both;
margin-left: auto;
margin-right: auto;
/* [disabled]list-style: none; */
padding: 0px;
-webkit-flex-flow: row wrap;
justify-content: center;
font-size: 1.4em;
letter-spacing: 1px;
overflow: hidden;
padding-bottom: 10px;
text-align: center;
width: 100%;
display:inline;
}

 li{
 display: inline;
 list-style-type: none;
}

 .scaling{
 min-width:25%;
 display:inline block;

 }

 .invert{
 }

 .invert:hover{
-webkit-filter: invert(100%);
transition: all 100ms linear 0s;


 }


 /* Mobile Layout: 480px and below. */

 .gridContainer {
margin-left: auto;
margin-right: auto;
width: 87.36%;
padding-left: 1.82%;
padding-right: 1.82%;
word-wrap:break-word;

 }
 #LayoutDiv1 {
clear: both;
float: left;
margin-left: 0;
width: 100%;
display: block;
 }

 #LayoutDiv2 {
 clear: both;
 float: left;
 margin-left: 0;
 width: 100%;
 display: block;
 }

 p{
 padding:5px;
 }


 body, html {
 height: 100%;
 padding:1px;
 }

 #content{
 display:inline-block;
 float:left;
 width:80%;
 background:#F36;
 height:100%;

 }

 #sidebar{
display: inline-block;
background:#0FC;
float: left;
width: 20%;

word-wrap:break-word;
 }

 #sidebar-content{
 padding:5px;
 overflow:hidden;
word-wrap:break-word;

 }




 .search-input{
 width:70%;
  }

 .footer{
 background:#00F;
 }

 #LayoutDiv3{
 clear: both;
 float: left;
 margin-left: 0;
 width: 100%;
 display: block;
 }

 @media (max-width: 480px) {

gridContainer {
width: 90.675%;
padding-left: 1.1625%;
padding-right: 1.1625%;
word-wrap:break-word;

 }
  #LayoutDiv1 {
clear: both;
float: left;
margin-left: 0;
width: 100%;
display: block;
 }


 #LayoutDiv2 {
clear: both;
float: left;
margin-left: 0;
width: 100%;
display: block;
 }
#LayoutDiv3{ clear: both;  float: left;  margin-left: 0;  width: 100%;  display: block;      }


#sidebar{ clear: both; width: 100%; }
#content{ clear: both; width: 100%; }
 }




 /* Tablet Layout: 481px to 768px. Inherits styles from: Mobile Layout. */

  @media only screen and (min-width: 481px) {
 .gridContainer {
width: 90.675%;
padding-left: 1.1625%;
padding-right: 1.1625%;
word-wrap:break-word;

}


  #LayoutDiv1 {
clear: both;
float: left;
margin-left: 0;
width: 100%;
display: block;
 }


  #LayoutDiv2 {
clear: both;
float: left;
margin-left: 0;
width: 100%;
display: block;
 }

 #LayoutDiv3 {
clear: both;
float: left;
margin-left: 0;
width: 100%;
display: block;
 }





 /* Desktop Layout: 769px to a max of 1232px.  Inherits styles from: Mobile Layout and  Tablet Layout. */

 @media only screen and (min-width: 769px) {
 .gridContainer {
width: 88.2%;
max-width: 1232px;
padding-left: 0.9%;
padding-right: 0.9%;
margin: auto;
 }
 #LayoutDiv1 {
clear: both;
float: left;
margin-left: 0;
width: 100%;
display: block;
 }
 #LayoutDiv2 {
clear: both;
float: left;
margin-left: 0;
width: 100%;
display: block;
 }

 #LayoutDiv3 {
clear: both;
float: left;
margin-left: 0;
width: 100%;
display: block;
 }


 }

我知道这可能有很多值得关注,但如果有人可以帮助我尽可能地做到这一点,那么我们将非常感激。

1 个答案:

答案 0 :(得分:0)

将类.search-input设置为搜索文本框。

<input type="text" 
                                       value="search" onblur="if(this.value=='')this.value='search'" onfocus="if(this.value=='search')this.value=''"
                                       class="search-input" />

编辑:添加了JSFiddle http://jsfiddle.net/P6sr2/