简体   繁体   中英

My HTML <a> tag is not showing the title attribute

Should the title attribute work in a tag?, I have this one:

<a class="btn btn-default btn-sm" data-toggle="confirmation" 
data-title="¿Está seguro que desea eliminar?" id="confirmation" 
data-btnOkLabel="Sí" data-btnCancelLabel="No" data-btnCancelClass="borde"
data-href="Evento_controlador.php?del={$evento.id}" 
title="Borrar" name="ver_evento2"><i class="icon-remove"></i></a>

And its not showing the title information. I don't know why.

You have to have something to display inside of A tag. For example add TEST TEXT:

<a class="btn btn-default btn-sm" data-toggle="confirmation" 
data-title="¿Está seguro que desea eliminar?" id="confirmation" 
data-btnOkLabel="Sí" data-btnCancelLabel="No" data-btnCancelClass="borde"
data-href="Evento_controlador.php?del={$evento.id}" 
title="Borrar" name="ver_evento2"><i class="icon-remove">Test Text</i></a>

Demo: http://jsfiddle.net/JftrA/

Title is a tooltip that will be displayed when you hover over that text.

UPDATE : With a correct CSS you do not need content inside of A tag. For example:

.icon-remove {
    width:100px;
    height:100px;
    display:block;
    background-color:red;
}

Demo: http://jsfiddle.net/JftrA/2/

Make sure your CSS is correct.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM