我想将对象向右移动,但不知道如何!?任何想法?
。请帮我。这是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/

10-11 14:33