Results 1 to 2 of 2

Thread: Placing text under images

  1. #1
    Join Date
    Dec 2011
    Posts
    2

    Question Placing text under images

    These tabs are designed with <input type="radio">

    http://virtual.comocreartuweb.es/ (Check it on chrome)

    How can text (Primera/Segunda/Tercera) be placed under the picture, displaying the tabs one next to the other?
    Last edited by virtualweb; 06 Mar 2012 at 07:12 AM.

  2. #2
    Join Date
    Dec 2011
    Posts
    2
    Wickham at http://www.webdesignerforum.co.uk, succeed: Basically he wrapped the text with span and displayed it as a block element; the image was set with a display:block and also a float:left attribute.
    Code:
    <!DOCTYPE html>
    <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <title></title> <style type="text/css">@charset "utf-8";
    /* CSS Document */
    /*normaliza css/*/
    *{content:0; padding:0; border:0; margin:0;outline:0;}
    body{font-size:100%; font-family:Verdana, Geneva, sans-serif; background-color:#F1F1F1}
    a{text-decoration:none; outline-style:none;}
    img{border-width:0;}
    
    /* rectángulo contenedor */
    #secciones{position:absolute; top:40%; width:100%; height:50%; background-color:red; border-bottom:1px solid blue;}
    .pestaña{display: inline; /* NEW *******/width: 128px; overflow: hidden; height: 190px; /******** NEW */}
    
    /* título de la pestaña */
    .pestaña label{color:#666; cursor:pointer; padding:1%; /* NEW *******/display: block; width: 128px; float: left; overflow: hidden;}
    label span { display: block; width: 128px; text-align: center; }/******** NEW */
    /* contenido*/
    .contenido{position:absolute; background-color:lightgreen; top:177px;/*155px; 140px;*/ width:100%; }
    
    /* oculta radio */
    .pestaña [type=radio]{display:none;}
    
    /* pestaña activa */
    [type=radio]:checked ~ label{color:#333; background:green; border:1px solid pink; border-bottom-color:orange; z-index:2;}
    [type=radio]:checked ~ label ~ .contenido{z-index:1;}
    
    
    </style>
    </head>
    <body>
    
    <div id="secciones">
    
    <div class="pestaña">
    <input type="radio" id="tab1" name="secciones" checked="" value="1">
    <label for="tab1"><img id="imageninmuebles" src="./index_files/inmuebles128.png"><span>Primera</span></label>
    <div class="contenido">ooohjhk1</div>
     
    <div class="pestaña">
    <input type="radio" id="tab2" name="secciones" value="2">
    <label for="tab2"><img id="imagenvehiculos/vehiculos" src="./index_files/vehiculos128.png"><span>Segunda</span></label>
    <div class="contenido">2</div>
    
    <div class="pestaña">
    <input type="radio" id="tab3" name="secciones" value="3">
    <label for="tab3"><img id="imagencompras" src="./index_files/compras128.png"><span>Tercera</span></label>
    <div class="contenido">3</div> 
    </div>
    
    </div></div></div>
    
    </body></html>

Similar Threads

  1. placing two images inside div without overlapping when minimizing window
    By webdevnewbie in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 07 Dec 2010, 09:18 AM
  2. Placing images from Bridge CS3??
    By wandoledzep in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 05 Nov 2008, 05:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •