2011-09-05 7 views
1

내 응용 프로그램에 대한 Facebook 스타일 검색 제안 기능을 구현했습니다. 그러나 나는 여기서 어떤 문제에 직면하고있다.html 문제, div 위치 지정 문제

I) 다음은 검색 상자와 결과 DIV 코드 :

<div align="right" style=" width:300px; float:right; margin-right:30px"> 
      <input type="text" id="searchbox" class="searchbox" maxlength="100" style="color: rgb(170, 170, 170);">&nbsp; &nbsp;<img src="../../../asset/images/search.png" style="margin:0 0 -5px 2px"><br><br> 
      <input type="hidden" value="http://www.plus-one-me.com/search/google/interests" id="formurl" name="formUrl"> 
       <div id="display"> 
       </div> 
      </div> 

결과 DIV 아래와 같이 #display에 표시 얻을 검색 :

<div id="display" style="display: block;"> 
    <div class="display_box" align="left"> Cakephp </div> 
    <div class="display_box" align="left"> Myspace </div> 
    <div class="display_box" align="left"> Php </div> 
</div> 

이 어떻게되어 검색 영역에 무엇이든 입력하기 전에 페이지가 나타납니다. enter image description here

다음은 사업부가하고있는 검색 결과 :

enter image description here

기본적으로, 그것은 내 주요 내용 영역의 메뉴를 제공합니다. 그렇다면 CSS를 사용하여이 문제를 어떻게 해결할 수 있습니까?

#searchbox { 
border: 1px solid #000000; 
padding: 3px; 
width: 250px; 
} 
: 배경 (옵션을 , 역사설정 내 정보 검색의

.menuBar .submenu { 

padding:4px 12px 5px 12px; 
margin-right:8px; 
border:2px solid #EEE; 
text-decoration:none; 
display:inline-block; 
float:left; 
font-size:13px; 
-moz-border-radius:40px; 
border-radius:40px; 
-webkit-border-radius:40px; 
-moz-box-shadow:0 1px 3px #777; 
-webkit-box-shadow:0 2px 3px #777; 
box-shadow:0 2px 3px #777; 
color:#333; 
background: -webkit-gradient(linear, 0 0, 0 70%, from(#765), to(#FFF)); 
background: -webkit-linear-gradient(#000, #FFF 70%); 
background: -moz-linear-gradient(#BBB, #FFF 100%); 
background: -ms-linear-gradient(#765, #FFF 70%); 
background: -o-linear-gradient(#765, #FFF 1000%); 
background: linear-gradient(#765, #FFF 70%); 
-pie-background: linear-gradient(#765, #FFF 70%); 
} 

을 포함에있는 메뉴 사업부의

: 아래

는 스타일이다

및 dis 개별 결과 play_box : 다운 메뉴

.display_box { 
border-top: 1px solid #DEDEDE; 
font-size: 12px; 
height: 30px; 
padding: 4px; 
} 

enter image description here

답변

4

드롭은 position:absolute이 적용해야한다. 이렇게하면 다른 요소에 영향을주지 않으므로 페이지 흐름에서 벗어납니다. @Galen 제안으로

+0

감사합니다 Galen ... 그것은 작동하도록 바인딩 된 ... :) – debaShish

1

시도 CSS : 당신은 대신 HTML 먹으 렴을 할 수 있습니다

#display { 
position: absolute; 
} 

뭔가 당신이 그랬다면, 당신은 함께 CSS를 것 같이 더 많은

<ul id="display"> 
    <li>result</li> 
    <li>result</li> 
    <li>result</li> 
</ul> 

수 출력 됨

의 라인
#display { 
    position: absolute; 
    list-style-type: none; list-style: none; 
    margin: 0; padding: 0; 
} 

#display li { 
    display: block; 
    border-top: 1px solid #DEDEDE; 
    font-size: 12px; 
    height: 30px; 
    padding: 4px; 
} 
+0

감사합니다 @ KeenLearner ... th 에 당신이 정말로 알맞은 스타일 목록을 작성하는 것이 좋았습니다. :) – debaShish