html - 如何将此菜单栏向右移动

标签 html css menu blogs

我想向右移动对象,但不知道怎么做!?任何想法? .请帮我。这是 HTML 和 CSS 中的代码

/*=====================================
= Top Bar
=====================================*/
#top-bar {
    height: 42px;
    line-height: 40px;
    background: #f9f9f9;
    color: #888;
    font-size: .857em;
    border-bottom: 1px solid #f5f5f5;
}


.top-nav ul li {
    display: block;
    float: left;
}

.top-nav ul {
    margin: 0;
    padding: 0;
}


.top-nav {
    font-family: "Montserrat",Open Sans,Sans-serif;
}

.top-nav ul li a {
    color: #111;
    text-decoration: none;
    display: inline-block;
    padding: 0 15px;
    line-height: .917em;
    color: #888;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-size: .917em;
    border-right: 1px solid #eee;
}


.top-notification {
    float: right;
}

.top-notification p {
    margin: 0;
    float: left;
    font-size: 13px;
}

.top-notification a {
    color: #111;
    text-decoration: none;
    /* display: inline-block; */
    padding: 5px 9px;
    line-height: .917em;
    color: #888;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-size: .917em;
    border: 1px solid #D1D1D1;
    margin-left: 22px;
	background:#fff;
}

nav ul {
	padding: 0;
  margin: 0;
	list-style: none;
	position: relative;
	}
	
nav ul li {
	display:inline-block;
	}

nav ul li a:link {
    display: inline-block;
    padding: 15px 25px;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    text-decoration: none!important;
    color: #fff;
	width:100%;
}

nav ul li a {
    color: #fff!important;
}

nav a:hover { 
	    background-color: #2da399; 
}

/* Hide Dropdowns by Default */
nav ul ul {
	display: none;
	position: absolute; 
    z-index: 1000;
background: #494949;

}
	
/* Display Dropdowns on Hover */
nav ul li:hover > ul {
	display:inherit;
}
	
/* Fisrt Tier Dropdown */
nav ul ul li {
	min-width:170px;
	float:none;
	display:list-item;
	position: relative;
}

nav ul ul a:hover {
    background-color: #656565;

}

	
/* Change this in order to change the Dropdown symbol */
nav li > a:after { content:  ' +'; }
nav li > a:only-child:after { content: ''; }


.menu {
    width: 1200px;
    margin: auto;
	    z-index: 99999;
    background: #2da399;
}

.menu.cloned {
    width: 100%!important;
    left: 0!important;
}

.menu.cloned nav {
    width: 1200px;
    margin: auto;
}

Here is HTML codes for my website. I think every thing in is fine here and the problem is in CSS codes.
<!--Main Navigation-->
<div class='menu-wrapper'>
 <div class='menu'>
	<nav>
        <ul>
            <li><a href='https://thevoiceofafghanistan.blogspot.se/p/kontakta-mig.html'>Hem</a></li>
            <li><a href='#'>Nyheter </a>
            <!-- First Tier Drop Down -->
            <ul>
                <li><a href='https://thevoiceofafghanistan.blogspot.se/p/afghanistan.html'>Afghanistan</a></li>
                <li><a href='https://thevoiceofafghanistan.blogspot.se/p/sverige-och-e.html'>Sverige</a></li>
                <li><a href='#'>Världen</a></li>
            </ul>        
            </li>
            <li><a href='#'>Vetenskap
</a>
            <!-- First Tier Drop Down -->
            <ul>
              <li><a href='https://www.facebook.com/thevoiceofafghanistan/'>Kemi
</a></li>
                <li><a href='#'>Fysik </a></li>
                <li><a href='#'>Matte</a>
            	<!-- Second Tier Drop Down -->
                <ul>
                    <li><a href=''>Matte 1</a></li>
                    <li><a href='#'>Matte 2</a></li>
                    <li><a href='#'>Matte 3</a>
                        <!-- Third Tier Drop Down -->
                        <ul>
                            <li><a href='#'>Matte 4</a></li>
                            <li><a href='#'>Hjälpmedel
</a></li>
                            
                        </ul>
                    </li>
                </ul>
                </li>
            </ul>
            </li>
            <li><a href='#'>فناوری </a></li>    
            <li><a href='#'>اجتمائی </a></li>
			<li><a href='#'> سیاست</a></li>
            <li><a href='#'>تاریخ </a></li>
			<li><a href=''>کلاس ها</a></li>
			<li><a href='https://thevoiceofafghanistan.blogspot.se/'>صفحه اصلی </a></li>        
		</ul>
    </nav>
</div>
  </div>

This is menu bar

最佳答案

您应该在您的 CSS 中添加一些 margin-left。由于您还没有提供完整的 HTML,我不能说哪个属性确实需要样式。 我认为您应该将 margin-left 添加到您的菜单以增加它们之间的空间,或者添加到父级 div 以将整个导航栏向右移动。希望这对您有所帮助!

关于html - 如何将此菜单栏向右移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41726414/

相关文章:

html - 居中输入元素 - Bootstrap 面板

html - 如何居中对齐 CSS 导航菜单?

html - css 菜单中除最后一个子元素外的所有子元素都向左移动一个像素

html - 纯css打开/向上打开的下拉菜单

javascript - 填充具有 javascript 变量的 HTML 表,然后将该 HTML 变量作为预输入结果返回

html - Textarea 拉伸(stretch)父 div

html - 无法设置响应式 CSS 背景图片的样式

html - CSS 页边距内容未出现

javascript - 尝试获取 "background"的值时,getComputedStyle 在 Firefox 中返回 NULL,但在 Chrome 中有效

html - Bulma 输入宽度不一致