【问题标题】:how to give appropriate margin in css如何在css中给出适当的边距
【发布时间】:2013-11-15 18:35:53
【问题描述】:

这是我的文本框,我在其中填充了数据库中的城市名称并实现了自动完成功能..现在您可以看到自动完成框的左侧出现了一个恒定的间隙..如何从 cs 中删除该间隙..请帮助

<asp:AutoCompleteExtender ID="autoComplete1" runat="server"    
 EnableCaching="true"
  BehaviorID="AutoCompleteEx"
   MinimumPrefixLength="2"
  TargetControlID="myTextBox"
   ServicePath="AutoComplete.asmx"
  ServiceMethod="GetCompletionList" 
   CompletionInterval="1000"  
   CompletionSetCount="20"
    CompletionListCssClass="autocomplete_completionListElement"
  CompletionListItemCssClass="autocomplete_listItem"
  CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
  DelimiterCharacters=";, :"
  ShowOnlyCurrentWordInCompletionListItem="true">
  <Animations>
  <OnShow>
  <Sequence>
   <%-- Make the completion list transparent and then show it --%>
  <OpacityAction Opacity="2" />
   <HideAction Visible="true" />

     <%--Cache the original size of the completion list the first time
     the animation is played and then set it to zero --%>
      <ScriptAction Script="// Cache the size and setup the initial size
                            var behavior = $find('AutoCompleteEx');
                            if (!behavior._height) {
                                var target = behavior.get_completionList();
                                behavior._height = target.offsetHeight - 2;
                                target.style.height = '0px';
                            }" />
            <%-- Expand from 0px to the appropriate size while fading in --%>
           <Parallel Duration=".4">
             <FadeIn />
        <Length PropertyKey="height" StartValue="0" 
EndValueScript="$find('AutoCompleteEx')._height" />
           </Parallel>
         </Sequence>
          <OnHide>
      <%-- Collapse down to 0px and fade out --%>
              <Parallel Duration=".4">
        <FadeOut />
        <Length PropertyKey="height" StartValueScript=
"$find('AutoCompleteEx')._height" EndValue="0" />
         </Parallel>
     </OnHide>
           </Animations>

【问题讨论】:

  • 请贴一些代码
  • @AshkanMobayenKhiabani:哪个代码??..css 还是 asp?
  • html 或自动完成的脚本
  • 当您使用“list-style-type”时,假设您使用列表
    • 构建下拉列表是否正确?如果是这样添加边距:0;你的 UL 应该解决这个问题吗?
  • @AshkanMobayenKhiabani:我已更改代码,请参阅

标签: css autocomplete textbox


【解决方案1】:

可能是您的 CSS 中的空白问题
添加 white-space: nowrap; 并检查它是否有效

【讨论】:

  • 请显示您用于此自动完成的代码的 css。
【解决方案2】:

【讨论】:

  • 我正在编辑我的答案试试这个看看那个问题
【解决方案3】:

使用Autocomplete demo,您似乎需要在现有样式表下方的页面中添加样式。

CSS

.autocomplete_completionListElement,
.autocomplete_completionListElement > li {
    margin:0;
}

【讨论】:

    猜你喜欢
    • 2013-05-25
    • 1970-01-01
    • 2014-03-21
    • 2016-03-20
    • 2013-12-12
    • 1970-01-01
    • 2021-11-07
    • 2011-01-12
    相关资源
    最近更新 更多