Display content at the bottom using CSS

I have scoured both SO and Google for an answer to my problem, but haven't had any luck. I am trying to achieve a simple task, but I'm unsure of how to do it. Here is the scenario:

Currently, I am working on a website using HTML, CSS, and Bootstrap. Within this website, I have added some buttons with glyphicons, like the ones shown here: . Unfortunately, I am unable to post images at the moment.

Below is the code for one of the key buttons, with the rest following a similar format:

<a class="button" target="_blank" href="https://keybase.io/adolphenom">
    <i class="fa fa-key fa-lg"></i>
</a>

My objective is to have a text display at the bottom of the button when the cursor hovers over it (the specific styling of the text in terms of color and font is not a major concern right now).

I have tried several tutorials I came across, but none of them suit my requirements.

Could you please assist me?

Thank you in advance!


I am encountering another issue now. Following @monkeyinsight's advice (though instead of a div, I used a span as divs seem to disrupt other elements in the HTML), I face the following problem:

When I move the cursor off the icon but hover over the text below (by scrolling down instead of up), this occurs: . The text does not disappear :(

Could you offer your assistance once again? Thank you!

The CSS code is as follows:

span {
    position: relative;
}

a.button {
  color: #00628B;
  margin-left: 7.5px;
  margin-right: 7.5px;
  -webkit-transition: color 0.15s ease-in, background 0.15s ease-in;
  -moz-transition: color 0.15s ease-in, background 0.15s ease-in;
  -ms-transition: color 0.15s ease-in, background 0.15s ease-in;
  -o-transition: color 0.15s ease-in, background 0.15s ease-in;
  transition: color 0.15s ease-in, background 0.15s ease-in;
}

a.button:hover, 
a.button:focus {
  color: #575757;
  text-decoration: none;
  outline: 0;
}

.twitter:hover::after, 
.twitter:focus::after {
  font-family: 'Yanone Kaffeesatz', sans-serif;
  font-size: 60px;
  content: "Contact by email";
  display: block;
  position: absolute;
  top: 15px;
  left: -65px;
  color: #81A594;
  text-decoration: none;
}

Code for the span:

<span class="twitter">
  <a class="button" target="_blank" href="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7c1d1813100c14191213113c1b111d1510521f1311">[email protected]</a>">
    <i class="fa fa-envelope-o fa-lg"></i>
  </a>
</span>

Answer №1

To create the desired effect, leverage CSS pseudo element ::after and apply content like this: {content: 'twitter'}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble with downloading a PDF file on a React application's hosting platform

The issue with downloading the PDF file persists on an AWS hosting environment. import React, {Component} from 'react'; import aa from "../media/AA.pdf"; export default class FileDownloader extends Component { render() { re ...

Ways to implement JavaScript and CSS to set a specific zoom level for a webpage

Looking for a solution using html/css/javascript to standardize the zoom level on a website page. Any suggestions on how to implement this with javascript? ...

Save the outcome of an ArrayBuffer variable into an array within a Javascript code

I'm in the process of developing an offline music player using the HTML5 FileReader and File API, complete with a basic playlist feature. One challenge I'm facing is how to store multiple selected files as an ArrayBuffer into a regular array for ...

Tips for adjusting child elements to fit within their parent container even after zooming in

Is there a way I can ensure that the child div contents fit inside the parent div, even when zooming in on the screen? How can I prevent the child div from coming out of the parent div? <div> <div title="childDiv" style="width:auto;" ...

I am encountering a horizontal scroll bar despite setting the width to 100%

I am just starting out as a beginner in web development. I decided to create a webpage to practice my HTML and CSS skills. However, when I set the width of all elements to 100%, I noticed that I am getting a horizontal scroll bar. I have tried troubleshoot ...

Submission error occurs if file upload is absent

When attempting to submit a form with a file, I encounter issues if the selected file for upload is changed (e.g. renamed) before submitting the form. The form fails to submit. Below is an example of my code: <form action="test.htm" method="post" encty ...

CSS margin-left causing issues in Chrome Extension

My current situation is incredibly puzzling, as I am at a loss for what is happening. I developed a Firefox add-on using jQuery and CSS to revamp a website. When attempting to transfer the add-on to Chrome (which was relatively straightforward due to the s ...

Issue with the radio button functionality: it can be clicked on but does not change the background

I'm having trouble with creating inline radio buttons using bootstrap. Neither of the options are being selected. I've attempted various solutions such as adjusting the attributes for, name, and trying different ways to call the bootstrap functi ...

What is the correct way to transfer session variables to an email?

Currently, I am working on a project that involves extracting and sending data stored in the session variable $_SESSION['favourites']. To achieve this, I initially utilized the print_r function with the parameter set to true. The output generate ...

What is causing the collapsed-animation to malfunction in Vue3?

Why won't the transition animation function in vue3js? The animation does not appear to be working for me. I've implemented this library https://github.com/ivanvermeyen/vue-collapse-transition <template> <nav class="navbar color-d ...

Distribute divs of equal width evenly within a grid

I'm facing a unique challenge at the moment. I'm attempting to create a grid system where all elements have a fixed width of 200px each. What I envision is a clever grid setup using only CSS, where each "row" will strive to accommodate as many el ...

Displaying information from a database in an HTML form using PHP

Seeking assistance with managing data and populating: I'm in the process of creating an Employee database with two pages: 1. Add Employee 2. Modify Employee The "Add Employee" page requires input fields for EMP Name, EMP ID, Manager name (from a dro ...

JavaScript: Locate the HTML Attribute that Matches an ID

If you want to use just JavaScript, without relying on libraries like JQuery, how can you retrieve the data attribute associated with a specific Id? For example: <div id="id-test" data-qa="data-qa-test"> </div> Input: &quo ...

Unable to resize the div to fit the content

My container div is not adjusting its height based on the content inside. It expands according to the header and navigation divs, but not the sidebar which is nested inside another div. Here is the HTML structure: <div id="container"> <div ...

Angular 6 and Bootstrap 4 unite in a powerful collaboration, showcasing a stunning carousel feature enhanced with dynamic

Currently I am working on creating a carousel using Bootstrap 4 and Angular 6. Everything is functioning properly, except for one issue that I am facing. I am trying to add Indicators dynamically by using a *ngFor loop. The problem I am encountering is tha ...

Understanding the Intrinsic Dimensions of Replaced Elements in CSS

I'm currently facing some challenges with the CSS Intrinsic & Extrinsic Sizing Module Level 3, specifically chapter 4.1 on Intrinsic Sizes. This section is proving to be quite difficult for me: When a block-level or inline-level replaced element h ...

Using Bootstrap's dual listbox, you can easily select single options with the ability to add or delete them. Upon selection, the

Could someone please assist me in resolving this issue? I am looking for a dual listbox with single select option, unlike Bootstrap which only offers dual listboxes with single/multiple select. To Clarify: Here is an example: In my dual listbox, the le ...

iOS Font Display Issue in Ionic 2

I am currently in the process of developing an app using Ionic 2 and I want to incorporate a custom font called Quicksand. Here is how my folder structure looks: src | |-app | | | -app | | | | | -app.scss | | | -pages | | | -assets | ...

Issue with customizing Bootstrap5 table colors based on themes

In my latest project, I decided to customize Bootstrap 5.1.3 using Sass in order to introduce some new color themes to the panels. I quickly realized that customizing Bootstrap 5.1.3 is not as straightforward as it was with Bootstrap 4. After updating my ...

What is the best way to merge multiple attributes into a single attribute in HTML?

Is there a way to set a margin for a section of my site without it treating each attribute individually? I want to treat them as one attribute instead. Here's an example: <div style="background-color: grey; padding: 13px;"> <h1>This p ...