我想将 div#rakshak 中的图像浮动到 div#MainMenu 的右侧。如何修复以下站点中的 css
[网站已删除]
在 html 中替换它们的位置(div#rakshak 应该在 html 中的 div#MainMenu 之上),从 div#MainMenu 中删除 clear:right ,如果你想将其 margin-right 增加到 0 以上(我的建议是 10px)。
您将主菜单 div 和 rakshak div 的浮动设置为正确。
我建议您将菜单更改为向左浮动,这将解决问题,否则您更改 div 的顺序
选项1
#主菜单 { 向左飘浮; 明确:正确; 边距右:-8px; 边距顶部:42px; }
选项 2
<div id="MainHeader" class="pageWrapper clearfix">
<h1 id="Logo"><a href="http://www.gauravgatha.org"> <img src="http://www.gauravgatha.org/wp-content/uploads/2012/05/logo.png" alt="Gaurav Gatha" width="140" height="40"></a></h1>
<div id="rakshak" style="clear: right;float:right; margin-top:35px;">
<a href="http://www.rakshakfoundation.org"><img src="http://www.gauravgatha.org/wp-content/themes/parallelus-salutation/assets/images/rakshak.png"></a>
</div>
<div id="MainMenu">
<div class="inner-1">
<div class="inner-2">
<nav>
<div id="MM" class="slideMenu">
<ul id="menu-main-menu" class="menu"><li id="menu-item-3552" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-3552"><a href="http://www.gauravgatha.org">Home</a></li>
<li id="menu-item-3554" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3554" style="z-index: 300; "><a href="#" class="hasSubMenu">Contest<span class="subDown"></span></a>
<ul class="sub-menu" style="top: 31px; display: none; visibility: visible; ">
<li id="menu-item-3553" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3553"><a href="http://www.gauravgatha.org/contest/rules/">Rules and Regulations</a></li>
<li id="menu-item-3555" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3555"><a href="http://www.gauravgatha.org/contest/judging-criteria/">Judging Criteria</a></li>
<li id="menu-item-3556" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3556"><a href="http://www.gauravgatha.org/contest/the-jury/">The Jury</a></li>
<li id="menu-item-3557" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3557"><a href="http://www.gauravgatha.org/contest/rules/">Rules and Regulations</a></li>
<li id="menu-item-3558" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3558"><a href="http://www.gauravgatha.org/contest/important-dates/">Important Dates</a></li>
</ul>
</li>
<li id="menu-item-3559" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3559"><a href="#">Participate</a></li>
<li id="menu-item-3560" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3560"><a href="http://www.gauravgatha.org/faqs/">FAQs</a></li>
<li id="menu-item-3561" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-3561"><a href="http://www.gauravgatha.org/contact/">Contact Us</a></li>
<li id="menu-item-3563" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3563"><a href="http://www.rakshakfoundation.org/poem/" onclick="javascript:_gaq.push(['_trackEvent','outbound-menu','http://www.rakshakfoundation.org']);">Last Year Entries</a></li>
</ul> <div style="clear:left"></div>
</div>
</nav>
</div>
</div>
</div>
</div>
您将需要更改主菜单的样式:
#主菜单 { 浮动:对; 右边距:20px; 边距顶部:42px; }
改变 rakshak 和 mainmenu 的位置或浮动离开主菜单