Guiding the way with headings listed beneath every point

Hello there!

I am trying to achieve a specific layout using this image as a reference. In the image, there are 3 different background images (represented by three Divs) and I want to add 3 List Points labeled as "LV", "RP", "IP" with centered descriptions/headings below them (such as Lv: 15, RP: 16975, etc).

My main challenge lies in controlling the centered width of these elements. I am struggling to figure out the best approach using CSS.

This is my HTML:

<div class="package">
    <div class="item-description">
        <div class="col-md-3"><span class="title">LV</span><span class="description">15</span></div>
        <div class="col-md-3"><span class="title">RP<span><span class="description">16975</span></div>
        <div class="col-md-3"><span class="title">IP<span><span class="description">40000</span></div>
    </div>
</div>

Answer №1

Do you seek a design like this?

This layout uses multiple elements, which could potentially be transformed into pseudo elements. It provides a basic representation of the concept you are interested in.

Moreover, the utilization of IDs and classes makes it relatively easy to customize for your specific requirements.

.container {
  width: 32%;
  height: 200px;
  background: red;
  display: inline-block;
}
.container .title {
  margin-top: 100px;
  width: 32%;
  height: 100%;
  display: inline-block;
  vertical-align: middle;
  text-align: center;
  color: white;
}
#one {
  background: url(http://placekitten.com/g/300/300);
}
#two {
  background: url(http://placekitten.com/g/200/200);
}
#three {
  background: url(http://placekitten.com/g/300/200);
}
<div id="one" class="container">
  <div class="title">200
    <div class="desc">I'm a very long description</div>
  </div>
  <div class="title">300
    <div class="desc">desc</div>
  </div>
  <div class="title">400
    <div class="desc">Be More Dog</div>
  </div>
</div>
<div id="two" class="container">
  <div class="title">200
    <div class="desc">desc</div>
  </div>
  <div class="title">300
    <div class="desc">I'm a tree.</div>
  </div>
  <div class="title">400
    <div class="desc">What is a description?</div>
  </div>
</div>
<div id="three" class="container">
  <div class="title">200
    <div class="desc">desc</div>
  </div>
  <div class="title">300
    <div class="desc">a description of what?</div>
  </div>
  <div class="title">400
    <div class="desc">Don't you like, er, trees?</div>
  </div>
</div>


You might also consider:

Note: In this version, I've incorporated a pseudo element effect, but to maintain code simplicity, I applied it universally instead of on individual items (like descriptions).

html,
body {
  margin: 0;
  padding: 0;
}
.sec {
  width: 33%;
  height: 200px;
  background: red;
  background: url(http://placekitten.com/g/200/200);
  position: relative;
  text-align: center;
  color: white;
  vertical-align: middle;
  display: inline-block;
  line-height: 200px;
  margin-left: -0.5%;
}
.col {
  width: 32%;
  margin-left: -0.5%;
  font-size: 25px;
  display: inline-block;
  position:relative;
}

.col:after{
  padding-top:25px;
  font-size: 10px;
  position:absolute;
  content:"description";

  left:25%;
  }
<div class="sec">
  <div class="col">
    title
  </div>
  <div class="col">
    title2
  </div>
  <div class="col">
    title3
  </div>
</div>


<div class="sec">
  <div class="col">
    title
  </div>
  <div class="col">
    title2
  </div>
  <div class="col">
    title3
  </div>
</div>


<div class="sec">
  <div class="col">
    title
  </div>
  <div class="col">
    title2
  </div>
  <div class="col">
    title3
  </div>
</div>

Answer №2

Here's a CSS tip for you to try out:

.description, .title{float:left; width:100%; text-align:center;}

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

Input Form Label inexplicably rounded off at odd location

I've been utilizing Bootstrap to style my page, and I used the input form classes provided by Bootstrap to create this input field. However, upon loading the page, I noticed some strange rounding occurring between the label and the input space. http ...

Missing sidebar display

Hi there! I am having an issue with my sidebar not appearing correctly when I click on the toggle button. It seems to be moving to the side, but the sidebar itself is blank or transparent. I suspect that the problem lies within my JavaScript file. As a beg ...

Rearranging the layout of elements: CSS switches up the text and button,

Having an issue. I created a background image with gradient colors for my web project and clipped it. Within this element, there is text and a button that I want to be centered inside the element - with the text above and the button below. Initially, ever ...

Sometimes, in extremely rare instances, external stylesheets may fail to download or be properly applied

There have been very rare occurrences where major websites like Amazon and Facebook do not load a CSS file or apply the rules correctly, resulting in pages looking incomplete: I was recently asked to provide an internal explanation after receiving a compl ...

Changing CSS module variables through JavaScript programming

I'm currently utilizing an older version of react-boilerplate that includes CSS Modules, allowing for the creation of variables and the ability to import them into other CSS files. Below is my colors.css file: :root { /* Status colors */ --error ...

Prevent ui-select from being highlighted when clicked

here's a dilemma : (all in angular 1) I'm using a ui-select like this : https://i.stack.imgur.com/RzH2u.png Here's the code snippet : <div class="formZone-group"> <div class="mandatory-fl"> <div class="man ...

Library of User Interface components for React Native applications

As I embark on my journey of building my first major app using React Native, a question comes to mind. Is there a UI framework available for React Native that offers pre-styled components right out of the box? Similar to how Ionic provides a base theme a ...

Height set at 100% but not extending to the entire parent element

I've applied min-height: 100vh; to the body, and then height: 100% to the main element. However, the height of the main does not extend fully to its parent container. Could someone please help me understand why this is happening? Thank you. I'v ...

What is the best way to ensure my php variable is easily accessed?

Recently, I've been working on implementing a timer and came across the idea in a post on Stack Overflow. <?php if(($_SERVER['REQUEST_METHOD'] === 'POST') && !empty($_POST['username'])) { //secondsDif ...

Using jQuery to swap an image with a div element and then using the image as the

I have a collection of images in a div, like so: <div class="image-container"> <img width="174" height="174" src="http://mysite.com/images/portfolio/p1.jpg" class="image-style" typeof="foaf:Image"> <img width="174" height="174" src= ...

Flexbox Columns Maintaining Width when Window is Resized

My current challenge involves utilizing Flexbox to create a responsive layout with 5 boxes that shrink when the browser window is resized. However, 4 of these boxes are not reducing their width as expected when placed in columns. (Despite Bob behaving cor ...

Animate the height transition of contenteditable after a line of text is added (using shift+enter) or removed

Currently, the contenteditable attribute is being utilized on the <div> tag to enable autogrow functionality similar to a textbox. Additionally, there is an attempt to incorporate a height transition. While most aspects are functioning correctly, the ...

Is there a way to automatically extend my content to fill the space on the page below the Material UI AppBar?

I am currently using React and Material UI React to develop my application. My goal is to implement the AppBar component with content underneath, without causing the entire page to scroll. I want the content to occupy the maximum remaining height and the f ...

There was an issue loading the map on an HTML code that was returned from an ajax request

I'm currently working on building my own personal website, which is also my first webpage, and I'm encountering some difficulties with displaying a Google map. Here's a breakdown of my situation: my webpage consists of four links that load ...

Using PHP to generate a table populated with generic elements from an array

How can I create a dynamic table in PHP that can handle any generic array with different keys and values, including nested arrays? I want to use the same table structure for various arrays regardless of their content. Any advice on achieving this flexibili ...

``Enhance your website with stunning Bootstrap 4 image cards that beautifully showcase

I'm having trouble creating 3 simple image cards with captions in Bootstrap 4. No matter what I do, the image keeps taking up the entire card and covering the caption below it. My cards should look similar to Bootstrap's example card, using the ...

Using CSS box-shadow to elevate an image

I am looking to create a background wrapper using CSS instead of an image. My goal is to add box shadow to achieve the same look as shown in the attached image. I understand that I will need to use the box-shadow property for this task. However, I am uns ...

Alignment Woes in Bootstrap Designs

I'm seeking assistance regarding the alignment of content on my webpage. The content is not aligning properly with the sidebar and footer, and I'm unsure how to proceed. The page should have a left margin to avoid touching the sidebar, and the fo ...

Tips on positioning an element absolutely so that it stops right before another element as the screen width is adjusted

Imagine a scenario where there is a 'parent' block containing various elements, including a button. When the user clicks this button, a 'slide' element should appear and cover the parent block but only up to the button itself (as shown ...

"Add a new style sheet to the homepage of your WordPress site using the

I have been attempting to utilize a separate style sheet in order to customize the front page of my wordpress website. Despite several attempts, I have not had any success. Below is the current code that I am working with: add_action('wp_enqueue_styl ...