Hola, tambien existe la opcion de centrar tu ul dinamicamente utilizando
javascript, asi, encuentra el ancho de tu menu sin definir y lo centra en la
pagina, el unico inconveniente es que debes posicionar tu ul de forma
absoluta y especificar su altura, ademas de que si los visitantes no tienen
activo js, tu menu volvera a la izquierda :-S
de cualquier forma te dejo el script por si te sirve:
<script type="text/javascript">
positionIt = function() {
if( document.getElementById ) {
// Get a reference to divCentrado and measure its width and height.
var div = document.getElementById( "menuc" );
var divWidth = div.offsetWidth ? div.offsetWidth : div.style.width ?
parseInt( div.style.width ) : 0;
// Calculating setX and setX so the div will be centered in the
viewport.
var setX = ( getViewportWidth() - divWidth ) / 2;
// If setX or setY have become smaller than 0, make them 0.
if( setX < 0 ) setX = 0;
// Position the div in the center of the page and make it visible.
div.style.left = setX + "px";
div.style.visibility = "visible";
}
};
getViewportWidth = function() {
var width = 0;
if( document.documentElement && document.documentElement.clientWidth ) {
width = document.documentElement.clientWidth;
}
else if( document.body && document.body.clientWidth ) {
width = document.body.clientWidth;
}
else if( window.innerWidth ) {
width = window.innerWidth - 18;
}
return width;
};
window.onload = positionIt;
window.onresize = positionIt;
</script>
para que funcione, debes darle a tu ul el id "menuc" y en el css
position:absolute
Suerte!
_______________________________________________
Lista de distribución Ovillo
Para escribir a la lista, envia un correo a [email protected]
Puedes modificar tus datos o desuscribirte en la siguiente dirección:
http://lists.ovillo.org/mailman/listinfo/ovillo