Foros del Web » Creando para Internet » CSS »

Probleas para alinear en CSS

Estas en el tema de Probleas para alinear en CSS en el foro de CSS en Foros del Web. Código HTML: <html> <head> <style> /* Clearfix */ .clear:before, .clear:after { content: " "; display: table; } .clear:after { clear: both; } .clear { *zoom: ...
  #1 (permalink)  
Antiguo 27/06/2017, 15:10
 
Fecha de Ingreso: octubre-2012
Mensajes: 8
Antigüedad: 11 años, 6 meses
Puntos: 0
Pregunta Probleas para alinear en CSS

Código HTML:
<html>
<head>
<style>
/* Clearfix */
.clear:before, .clear:after {
    content: " ";
    display: table;
}

.clear:after {
    clear: both;
}

.clear {
    *zoom: 1;
}

a#pull {
    display: none;
}
nav {
    height: 40px;
    width: 100%;
    background: #3359BC;
    position: relative;
    border-bottom: solid 0px #DDD;

}

nav ul {
    padding: 0;
    margin: 0 auto;
    width: 700px; 
    height: 40px;
	
}

nav li {
    display: inline;
    float: left;
}

nav a {
    color: #FFF;
    display: inline-block;
    width: 100px;
    text-align: center;
    line-height: 40px;
}

nav li a {
    border-right: 0px solid #576979;
}

nav li:last-child a {
    border-right: 0;
}

nav a:hover, nav a:active {
    background-color: #5475C9;
}
@media only screen and (max-width : 500px) {
    nav {
        border-bottom: 0;
        height: auto;
		
    }

    nav ul {
        display: none;
        height: auto;
        width: 100%;
    }

    nav li {
        width: 50%;
        float: left;
        position: relative;
    }

    nav a {
        text-align: left;
        width: 100%;
        text-indent: 25px;
    }

    nav a#pull {
        display: block;
        background-color: #3359BC;
        width: 100%;
        position: relative;
    }

    nav a#pull:after {
        content:"";
        background: url('img/nav-icon.png') no-repeat;
        width: 30px;
        height: 30px;
        display: inline-block;
        position: absolute;
        right: 15px;
        top: 10px;
    }
}

</style>
</head>

<body>
<nav>
   <a id="pull" href="#">Menu</a>
	 <ul>
                    <li><a href="#" title="">Home</a></li>
					<li><a href="#" title="">Sociedad</a></li>
					<li><a href="#" title="">Mundo</a></li>
					<li><a href="#" title="">Economia</a></li>
					<li><a href="#" title="">Politica</a></li>
					<li><a href="#" title="">Tecno</a></li>
					<li><a href="#" title="">Deportes</a></li>
                    </li><br clear="all" />
    </ul>
</nav>
</body>
</html> 
Hola, buenas tardes Como hago para poner el < UL> osea todo el menú hacia la derecha desde el CSS, no me deja hacerlo, igualmente este menú es descargado y no pude acomodar esa parte.

Gracias.
  #2 (permalink)  
Antiguo 28/06/2017, 09:00
Avatar de KATHYU  
Fecha de Ingreso: julio-2013
Mensajes: 547
Antigüedad: 10 años, 9 meses
Puntos: 46
Respuesta: Probleas para alinear en CSS

Lo probé en https://jsfiddle.net/ y funciono bien.

Código HTML:
Ver original
  1. nav ul {
  2.     padding: 0;
  3.     margin: 0 auto;
  4.     width: 700px;
  5.     height: 40px;    
  6.    float:right; /* Esta es la linea que hace todo*/
  7. }
__________________
Al contrario de lo que muchos podrían afirmar, ayudar no te hace pobre, sino más rico.

Última edición por KATHYU; 28/06/2017 a las 10:08

Etiquetas: css3, html, html5
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:08.