Скрыть заголовок из всплывающей подсказки - программирование

Скрыть заголовок из всплывающей подсказки

Я делаю всплывающую подсказку с помощью CSS. Теперь, используя следующий HTML-код

<div title="This is some information for our tooltip." class="progress3">
</div>

и следующий CSS

.progress3{
display: inline;
position: relative;
}

.progress3:hover:after{
background: #333;
background: rgba(0,0,0,.8);
border-radius: 5px;
bottom: 26px;
color: #fff;
content: attr(title);
left: 20%;
padding: 5px 15px;
position: absolute;
z-index: 98;
width: 220px;
content: attr(title);
}

.progress3:hover:before{
border: solid;
border-color: #333 transparent;
border-width: 6px 6px 0 6px;
bottom: 20px;
content: "";
left: 50%;
position: absolute;
z-index: 99;
}

Теперь он работает, когда я наводил на него надпись, показывает всплывающую подсказку, но также показывает название... Как удалить то, что было обведено оранжевым на изображении ниже.

enter image description here

4b9b3361

Ответ 1

Просто не добавляйте контент с помощью атрибута title, измените его на что-то вроде data-tooltip.

.progress3:hover:after {
    content: attr(data-tooltip);
}

Пример jsFiddle

Вы можете использовать JS/jQuery, но, учитывая подход, который вы используете, невозможно скрыть/удалить его, сохраняя функциональность, так как вам нечего было бы добавлять через CSS.

HTML

<div data-tooltip="This is some information for our tooltip." class="progress3">
</div>

CSS

.progress3 {
    position: relative;
    width: 100px;
    height: 100px;
    background: red;
}

.progress3:hover:after {
    background: #333;
    background: rgba(0,0,0,.8);
    border-radius: 5px;
    bottom: 26px;
    color: #fff;
    content: attr(data-tooltip);
    left: 20%;
    padding: 5px 15px;
    position: absolute;
    z-index: 98;
    width: 220px;
}

.progress3:hover:before {
    border: solid;
    border-color: #333 transparent;
    border-width: 6px 6px 0 6px;
    bottom: 20px;
    content: "";
    left: 50%;
    position: absolute;
    z-index: 99;
}