Maison > Article > interface Web > div设置margin:0 auto;后弹出框错位,求解!_html/css_WEB-ITnose
<div id="sub-header"> <div class="layout"> <a id="sub-logo" href="{$_G[siteurl]}"><img src="/style/images/small_logo.jpg" title="$_G['setting']['bbname']" alt="$_G['setting']['bbname']" /></a> <div id="sub-menu"> <dl class="menu-nav"> <dt><a href="{$_G[siteurl]}" onMouseOver="showMenu({'ctrlid':'twt','duration':'2'});">123</a></dt> <dd id="twt_menu" class="nav-floor" style="max-width:90%"> <ol> <!--{eval $i = 1;}--> <!--{loop $catlist $cat}--> <!--{eval $forumurl = !empty($forum['domain']) && !empty($_G['setting']['domain']['root']['forum']) ? 'http://'.$forum['domain'].'.'.$_G['setting']['domain']['root']['forum'] : 'forum.php?mod=forumdisplay&fid='.$cat[fid];}--> <li><a href="$forumurl" title="$cat[name]"><!--{if $i <= '9'}-->$number{$i}<!--{else}-->{$i}<!--{/if}-->#$cat[name]</a></li> <!--{eval $i ++;}--> <!--{/loop}--> </ol> </dd> </dl> </div><!--{if $_G['setting']['search']}--> <!--{eval $slist = array();}--> <!--{if $_G['fid'] && $_G['forum']['status'] != 3 && $mod != 'group'}--><!--{block slist[forumfid]}--><li><a href="javascript:;" rel="curforum" class="curtype">{lang search_this_forum}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['portalstatus'] && $_G['setting']['search']['portal']['status'] && ($_G['group']['allowsearch'] & 1 || $_G['adminid'] == 1)}--><!--{block slist[portal]}--><li><a href="javascript:;" rel="article"{if CURSCRIPT == 'portal'} class="curtype"{/if}>{lang article}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['search']['forum']['status'] && ($_G['group']['allowsearch'] & 2 || $_G['adminid'] == 1)}--><!--{block slist[forum]}--><li><a href="javascript:;" rel="forum"{if (CURSCRIPT == 'forum' && !$_G['fid']) || (CURSCRIPT == 'home' && in_array($do, array('thread', 'activity', 'poll', 'reward', 'debate', 'trade')))} class="curtype"{/if}>{lang thread}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['homestatus'] && $_G['setting']['search']['blog']['status'] && ($_G['group']['allowsearch'] & 4 || $_G['adminid'] == 1)}--><!--{block slist[blog]}--><li><a href="javascript:;" rel="blog"{if CURSCRIPT == 'home' && $do == 'blog'} class="curtype"{/if}>{lang blog}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['homestatus'] && $_G['setting']['search']['album']['status'] && ($_G['group']['allowsearch'] & 8 || $_G['adminid'] == 1)}--><!--{block slist[album]}--><li><a href="javascript:;" rel="album"{if CURSCRIPT == 'home' && $do == 'album'} class="curtype"{/if}>{lang album}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['groupstatus'] && $_G['setting']['search']['group']['status'] && ($_G['group']['allowsearch'] & 16 || $_G['adminid'] == 1)}--><!--{block slist[group]}--><li><a href="javascript:;" rel="group"{if CURSCRIPT == 'group' || $_G['basescript']=='group'} class="curtype"{/if}>$_G['setting']['navs'][3]['navname']</a></li><!--{/block}--><!--{/if}--> <!--{block slist[user]}--><li><a href="javascript:;" rel="user"{if (CURSCRIPT == 'home' && !in_array($do, array('blog', 'album', 'thread', 'activity', 'poll', 'reward', 'debate', 'trade'))) || $mod == 'ranklist'} class="curtype"{/if}>{lang users}</a></li><!--{/block}--><!--{/if}--> <!--{if $_G['setting']['search'] && $slist}--> <div id="sub-search"> <form id="scbar_form" method="{if $_G[fid] && !empty($searchparams[0])}get{else}post{/if}" autocomplete="off" onsubmit="searchFocus($('scbar_txt'))" action="{if $_G[fid] && !empty($searchparams[0])}$searchparams[0]{else}search.php?searchsubmit=yes{/if}" target="_blank"> <input type="hidden" name="mod" id="scbar_mod" value="search" /> <input type="hidden" name="formhash" value="{FORMHASH}" /> <input type="hidden" name="srchtype" value="title" /> <input type="hidden" name="srhfid" value="$_G[fid]" id="dzsearchforumid" /> <input type="hidden" name="srhlocality" value="$_G['basescript']::{CURMODULE}" /> <!--{if !empty($searchparams[1])}--> <!--{loop $searchparams[1] $key $value}--> <!--{eval $srchotquery .= '&' . $key . '=' . $value;}--> <input type="hidden" name="$key" value="$value" /> <!--{/loop}--> <input type="hidden" name="source" value="discuz" /> <input type="hidden" name="fId" value="" id="cloudsearchforumId" /> <input type="hidden" name="q" id="cloudsearchquery" value="" /> <!--{/if}--> <input type="text" name="srchtxt" id="scbar_txt" autocomplete="off" class="sub-search-key" placeholder="搜你想要的..."> <dl class="sub-serach-switch"> <dt id="scbar_type" onclick="showMenu(this.id)" hidefocus="true">{lang search}</dt> </dl> <input type="submit" name="searchsubmit" id="scbar_btn" class="sub-search-btn" value="true"> </form> </div> <!--{/if}--> <ul id="scbar_type_menu" class="p_pop" style="display: none; margin-top:0;"><!--{echo implode('', $slist);}--></ul> <script type="text/javascript"> initSearchmenu('scbar', '$searchparams[0]'); </script> </div></div>
.layout {margin:0 auto;width:960px;}
你layout是弹出框更加外面的一层div吧,你的那个弹出框会继承这个样式的,你再给你的弹出框设一个样式来抵消试试
你layout是弹出框更加外面的一层div吧,你的那个弹出框会继承这个样式的,你再给你的弹出框设一个样式来抵消试试
抵消不了
你应该给layout里面的元素加居中吧?
不应该给外层layout加居中。。。给外层加居中当然会错位~·
你应该给layout里面的元素加居中吧?
不应该给外层layout加居中。。。给外层加居中当然会错位~·
请问该正样来居中layout
sub-header 你可以给外层一个相对对位
然后里面的layout 用绝对定位 来定位
这样就不会影响了~·
sub-header 你可以给外层一个相对对位
然后里面的layout 用绝对定位 来定位
这样就不会影响了~·
不行 解决不了