Content move down when I apply float property

后端 未结 3 1678
北恋
北恋 2021-01-25 21:28

I have to float the class time to right but when I try to float it right, its content moves down. Without float contents look fine but I have to float it.

h

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-25 21:49

    Is it this what you are looking for?

    Code:

    .main-nav{
    	color:#FFF;
    	width:100%;
    	background-color:#5e2d91;
    	float:right;
    	line-height:42px;
    	    margin-top: -3px;
    	}
    .main-nav ul li{
    	display: inline;
        padding: 0px 10px;
        
    	
    }
    .main-nav ul li a{
    	color:#FFF;
    	text-decoration:none;
    	padding: 20px 14px;
    	
    }
    .main-nav ul{
    	margin-bottom:7px !important;}
    .main-nav ul li a:hover {
    	background-color:#0098aa;
    }
    .main-nav ul li a:active{
    	
    	background-color:#6A006A;
    }
    .time {
     float: right;
        background: #5e2d91;
        color: #FFFFFF;
        border-color: #718b88;
        font-family: sans-serif;
        font-weight: bold;
        border-style: solid;
        margin-left: 10%;
        width: 228px;
        height: 33px;
        margin-top: 0;
        float: right;
            line-height: 2.2;
    }

提交回复
热议问题