Foros del Web » Creando para Internet » CSS »

centrar contenido

Estas en el tema de centrar contenido en el foro de CSS en Foros del Web. Muy buenas... Llevo 3 horas perdidas intentando ver donde está el fallo, pero cuánto más miro y más modifico, más se desestructura la pagina... La ...
  #1 (permalink)  
Antiguo 10/09/2015, 02:15
 
Fecha de Ingreso: mayo-2015
Mensajes: 92
Antigüedad: 8 años, 10 meses
Puntos: 1
centrar contenido

Muy buenas...
Llevo 3 horas perdidas intentando ver donde está el fallo, pero cuánto más miro y más modifico, más se desestructura la pagina...
La cuestión es que estoy adaptando un diseño a dispositivo movil, la primera fila y su contenido me sale centrado y las siguientes filas y contenidos me salen desplazadas a la izq y sin embargo tienen la misma estructura y etiquetas que la fila primera...
OS dejo el código y a ver si podéis echarme una mano.
Gracias

Código HTML:
 <div class="row">
                <div class="col-lg-12">
                    <div class="timeline-image">
                        <img src="img/estudios.png" alt="estudios">
                    </div>
                </div>
            </div>
            <div class="row">
                <article>
                    <div class="col-lg-4 col-lg-6 col-xs-4">
                        <div class="timeline-panel">
                            <div class="timeline-heading">
                                <div class="img-icon">
                                    <img src="img/video.png" alt="icono" width="70px" height="70px">
                                </div>
                                <h4>Graduado Superior<br> en Mass Media</h4>
                                <h4 class="subheading">Universidad de Vic</h4>
                                <h5 class="subheading">2001-2004</h5>

                                <p class="text-list">
                                    Aprendiendo del mundo audiovisual y periodismo.
                                    <br> Forjando la base de mis estudios.
                                </p>
                            </div>
                        </div>
                    </div>

                </article>
            </div>
            <div class="row">
                <article>
                    <div class="col-lg-4 col-lg-6 col-xs-4">
                        <div class="timeline-panel">
                            <div class="timeline-heading">
                                <div class="img-icon">
                                    <img src="img/disenio.png" alt="icono" width="70px" height="70px">
                                </div>
                                <h4>Técnico en <br> diseño gráfico </h4>
                                <h4 class="subheading">New horizons. Barcelona
</h4>
                                <h5 class="subheading">2004-2006</h5>

                                <p class="text-list">
                                    Descubrir una nueva ilusión por lo gráfico.
                                    
                                </p>
                            </div>
                        </div>
                    </div>

                </article>
            </div>
            <div class="row">
                <article>
                    <div class="col-lg-4 col-lg-6 col-xs-4">
                        <div class="timeline-panel">
                            <div class="timeline-heading">
                                <div class="img-icon">
                                    <img src="img/multimedia.png" alt="icono" width="70px" height="70px">
                                </div>
                                <h4>Técnico digital <br>
                                            y multimedia </h4>
                                <h4 class="subheading">New horizons. Barcelona
</h4>
                                <h5 class="subheading">2004-2006</h5>

                                <p class="text-list">
                                    Mezclar estudios con pasión.
                                 
                                </p>
                            </div>
                        </div>
                    </div>
                </article>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <div class="timeline-image">
                        <img src="img/CURSOS.png" alt="cursos">

                    </div>
                </div>
            </div>
          
           <div class="row">
                <article>
                    <div class="col-lg-4 col-lg-6 col-xs-4">
                        <div class="timeline-panel">
                            <div class="timeline-heading">
                                <div class="img-icon">
                                    <img src="img/iluminacion.png" alt="icono" width="70px" height="70px">
                                </div>
                                <h4>Técnico en Iluminación

                                       <h4 class="subheading">CPA. Barcelona
                                           </h4>
                                <h5 class="subheading"> Abril 2015</h5>

                                <p class="text-list">
                                    Conseguir profundidad en las imágenes.
                                    
                                </p>
                            </div>
                        </div>
                    </div>
                </article>
            </div>
            <div class="row">
                <article>
                    <div class="col-lg-4 col-lg-6 col-xs-4">
                        <div class="timeline-panel">
                            <div class="timeline-heading">
                                <div class="img-icon">
                                    <img src="img/audiovisual.png" alt="icono" width="70px" height="70px">
                                </div>
                                <h4>Técnico audiovisual

                                       <h4 class="subheading">CPA. Barcelona
                                           </h4>
                                <h5 class="subheading"> Abril 2015</h5>

                                <p class="text-list">
                                    Refrescar y desarrollar nuevas técnicas.
                                    <br> Actualizando ideas.
                                </p>
                            </div>
                        </div>
                    </div>
                </article>
            </div>
            <div class="row">
               <div class="col-lg-12">
                    <div class="timeline-image">
                        <img src="img/experiancia.png" alt="cursos">
                    </div>
                    <div class="row">
                        <article>
                            <div class="col-lg-4 col-lg-6 col-xs-4">
                                <div class="timeline-panel">
                                    <div class="timeline-heading">
                                        <div class="img-icon">
                                            <img src="img/albaserveis.png" alt="icono" width="70px" height="70px">
                                        </div>
                                        <h4>Diseño 
y publicidad 
                                       <h4 class="subheading">Alba Serveis Educatius. Girona
</h4>
                                        <h5 class="subheading"> Ago. 2010 - Ene. 2015</h5>

                                        <p class="text-list">
                                            Diseño corporativo de empresa.
                         
                                            <br>
                                            <a href="http://www.albaserveis.com">Sitio web</a>
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </article>
                    </div>
                    <div class="row">
                        <article>
                            <div class="col-lg-4 col-lg-6 col-xs-4">
                                <div class="timeline-panel">
                                    <div class="timeline-heading">
                                        <div class="img-icon">
                                            <img src="img/stopmotion.png" alt="icono" width="70px" height="70px">
                                        </div>
                                        <h4>Animación
audiovisual
                                       <h4 class="subheading">Frozen Moon. Wrexham. UK
</h4>
                                        <h5 class="subheading"> Jul. 2008 - Nov. 2008</h5>

                                        <p class="text-list">
                                            Animación por ordenador.
                                         
                                            <a href="http://www.frozenmoon.co.uk">Sitio web</a>
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </article>
                    </div>
                   
  #2 (permalink)  
Antiguo 10/09/2015, 02:19
 
Fecha de Ingreso: mayo-2015
Mensajes: 92
Antigüedad: 8 años, 10 meses
Puntos: 1
Respuesta: centrar contenido

y este es el código CSS

Código:
body, p, footer {
    margin: 0 auto;
    height: auto;
}
body {
    width: 100%;
    height: auto;
}
header {
    width: 100%;
    background-image: url(../img/candranc.jpg);
    background-size: cover;
}
header div.logo {
    width: 17%;
    margin: 0 auto;
}
header img {
    width: 100%;
    height: auto;
}
header div.logo img {
    width: 100%;
}
.barra {
    width: 100%;
    font-family: 'Calligraffitti', sans-serif;
    margin: 0 auto;
    border-top: 1px solid #00fa9a;
    overflow: hidden;
    height: 35px;
    background-color: rgba(002, 002, 002, 0.5);
}
.btn {
    font-size: 1em;
    padding: 0;
    float: left;
    list-style: none;
    position: relative;
    left: 50%;
}
.btn-bar {
    text-align: center;
    float: left;
    margin-left: 2.5em;
    position: relative;
    right: 50%;
    height: 0.5em;
    font-size: 1.1em;
}
.btn-bar a {
    color: #00fa9a;
    text-decoration: none;
}

.btn-bar a:hover {
    color: white;
    text-decoration: none;
}

.btn-bar a:active {
    color: white;
    text-decoration: none;
}

.btn-bar a:current {
    color: white;
    text-decoration: none;
}

h1 {
    font-size: 1.5em;
    color: #444;
    text-align: center;
    font-family: 'Calligraffitti', sans-serif;
}

h2 {
    font-family: 'Calligraffitti', sans-serif;
    font-size: 1em;
    color: #444;
    text-align: center;
}

article {
    
  
    
    
        margin: 0 auto;
    /* padding: 1em; */
    /* display: inline-block; */
    height: auto;
    /* float: left; */
    width: 100%;
}

article h2 {
    font-weight: bold;
    font-size: 4em;
    text-align: center;
}

p.descripcion {
    width: 70%;
    text-align: justify;
    margin-top: 1.5em;
}

article p {
    margin: 0 auto;
    font-size: 1.2em;
    font-style: oblique;
    color: #999;
    font-family: "Courier New", monospace;
}

.boton {
    border: 0;
    width: 80%;
    font-size: 2em;
    background-image: url(../img/icono1.png);
    background-repeat: no-repeat;
    border-radius: 100%;
    height: 4em;
    background-position: center;
}

boton .botonaco a {
    background-color: white;
}

.container h2 {
    color: #00fa9a;
    display: block;
    width: 100%;
    font-size: 4em;
    font-weight: bold;
    clear: left;
    margin-top: 1em;
}

.row {
    width: 100%;
    margin: 0 auto;
    margin-right: -15px;
    margin-left: -15px;
    margin-bottom: 3em;
}

.col-lg-12 {
    width: 100%;
    clear: left;
    padding: 0;
}

.col-lg-4 {
    margin: 0 auto;
    margin-left: 2em;
    float: left;
    width: 18%;
}

.col-md-5 h2 {
    font-size: 1.7em;
    color: #333;
}

.col-md-5 li {
    list-style: none;
    margin-top: 1em;
}



.columnas p {
    width: 30%;
    border-radius: 100%;
}

.col-xs-3 {
    width: 40%;
    display: inline-block;
    background-color: yellow;
}

.col-lg-3 {
    width: 100%;
}

.col-lg-3 h2 {
    color: #444;
    font-size: 1.3em;
    font-weight: normal;
    float: left;
}

.table-responsive {
    width: 70%;
    margin: 0 auto;
    margin-top: 1em;
    border-radius: .3em;
    background-color: #00fa9a;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
}



#skills {
    margin-top: 4em;
    background-color: white;
}

footer {
   
    background-color: rgba(002, 002, 002, 0.8);
    margin-top: 1em;
    color: white;
    font-family: sans-serif;
    clear: both;
    text-align: center;
    background-size: cover;
    padding: 0.3em;
    padding-left: 1em;
}

footer a {
    color: white;
    text-decoration: underline;
}

footer a:hover {
    color: white;
}

.go-top {
    position: fixed;
    bottom: 2em;
    right: 2em;
    text-decoration: none;
    color: #fff;
    font-size: 12px;
    padding: 1em;
    display: none;
}

.p-body {
    margin-top: 3em;
   font-family: 'Voltaire', sans-serif;
    font-size: 1.2em;
    text-align: justify;
    width: 85%;
    margin: 3em auto;
}

.p-body-img {
    margin-right: 2em;
    float: left;
    margin-bottom: 4em;
}

.timeline-cursos {
    clear: both;
}
/* estilos timeline */

.img-icon {
    width: 100%;
    text-align: center;
}

.timeline-image {
    width: 80%;
    margin-top: 5em;
    margin-left: 7em;
    margin-bottom: 3em;
}

.timeline-panel {
    float: left;
    width: 100%;
    margin: 0 0 0 2em;
}

.timeline-heading {
    margin-left: 2.2em;
}

.timeline-heading h4 {
    color: #00fa9a;
    font-size: 1.4em;
    font-weight: bold;
    text-align: center;
    font-family: 'Voltaire', sans-serif;
}
h4{
    margin: .5em auto;
    font-family: 'Paytone One', sans-serif; 
}
h2.subheading {
    color: #00f49b;
    font-size: 2em;
}
h4.subheading {
    color: #444;
    font-size: 1em;
  font-family: 'Voltaire', sans-serif;
}
h5.subheading {
    color: #7D7C7C;
    font-size: 1em;
    margin-bottom: .5em;
    text-align: center;
   font-family: 'Voltaire', sans-serif;
    margin-top: 0;
}
p.text-list {
    text-align: center;
    margin-bottom: 3em;
    font-family: 'Voltaire', sans-serif;
}
.footer-section {
    width: 100%;
    margin: 0 auto;
}
.footer-section a {
    width: 100%;
    margin: 0 auto;
}


section.img_publi {
    margin-left: 4em;
}

section.img_cart {
    margin-left: 4em;
}

section.img_corp {
    margin-left: 4em;
}

section#contact {
    background-color: #222;
    background-image: url(../img/map-image.png);
    background-position: center;
    background-repeat: no-repeat;
}

.btn-xl {
    
    border-color: mediumspringgreen;
    border-radius: 3px;
    text-transform: uppercase;
    font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    background-color: mediumspringgreen;
    margin-bottom: 3em;
    width: 10%;
}


@media screen and (min-width: 240px) and (max-width:480px) {
  .p-body-img{
       margin: 0 auto;
       display: block;
       float: none;
       width: 50%;
       
   } 
    .p-body{
        margin: 0 2.4em;
        font-size: 1em;
    }
    /*
    h5.subheading{
        
        width: 100%;
        margin: 0 auto;
      margin-left: 2em;
    } */
    .col-xs-4{
        width: 100%;
        margin: 0 auto;
    }
    
    .timeline-image {
       width: 100%;
      
        padding: 0;
        margin: 0 0 0 1em;
        text-align: center;
        clear: both;
    } 
    .img-icon{
        width: 80%;
      
        padding: 0;
        margin: 0 auto;
        text-align: center;
    }
    .timeline-heading {
        margin: 0 auto;
        width:100%;
    }
    section {
        margin: 0 auto;
    }
    /*
    .text-list{
       margin-left: 3em;
   }
    */
  .col-lg-3<img{
      width: 25%;
      background-color: coral
  }/*
  #3 (permalink)  
Antiguo 10/09/2015, 02:40
Avatar de baldaweb  
Fecha de Ingreso: septiembre-2010
Ubicación: Barco pirata
Mensajes: 244
Antigüedad: 13 años, 7 meses
Puntos: 20
Respuesta: centrar contenido

tal vez sea por el float:left del col-lg-4? que te alinea los elementos a la izquierda...
__________________
CHOOO COOO LAAA TEEEEEEEEE
  #4 (permalink)  
Antiguo 10/09/2015, 02:47
 
Fecha de Ingreso: mayo-2015
Mensajes: 92
Antigüedad: 8 años, 10 meses
Puntos: 1
Respuesta: centrar contenido

Entiendo que si asigno para una misma etiqueta col-lg-4 y col-xs-4 y en el media query cambio los valores del col-xs-4, cogerá esos valores y no los del col-lg-4 no??? soy novata en esto y a veces me lía un poco el código.

Probé a sacar el float y nada.

gracias
  #5 (permalink)  
Antiguo 10/09/2015, 02:47
 
Fecha de Ingreso: mayo-2015
Mensajes: 92
Antigüedad: 8 años, 10 meses
Puntos: 1
Respuesta: centrar contenido

Cita:
Iniciado por baldaweb Ver Mensaje
tal vez sea por el float:left del col-lg-4? que te alinea los elementos a la izquierda...
Entiendo que si asigno para una misma etiqueta col-lg-4 y col-xs-4 y en el media query cambio los valores del col-xs-4, cogerá esos valores y no los del col-lg-4 no??? soy novata en esto y a veces me lía un poco el código.

Probé a sacar el float y nada.

gracias

Etiquetas: contenido, width
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 14:00.