What is the CSS/HTML code to position text at the bottom of an image overlay in a card design?

I've been attempting to modify the justify-content in the CSS class to "flex-end" and "end," however the text is not relocating to the bottom.

My suggestion is that we concentrate on the img-overlay class, as that's where we adjust the position of the text on the card.

.overlay.overlay-sm .shape {
  filter: brightness(0) invert(1);
  opacity: 0.15;
  height: 40px;
}

.overlay.overlay-sm .shape.wave {
  height: initial;
  width: 70px;
}

.overlay.overlay-sm .shape.xshape {
  height: 30px;
}

.portfolio .square {
  top: 28%;
  left: 20%;
}

.portfolio .circle {
  top: 8%;
  right: 35%;
}

.portfolio .triangle {
  top: 10%;
  right: 4%;
}

.portfolio .half-circle1 {
  bottom: 13%;
  left: 5%;
}

.portfolio .half-circle2 {
  bottom: 35%;
  left: 20%;
}

.portfolio .xshape {
  bottom: 10%;
  left: 8%;
}

.portfolio .wave {
  bottom: 38%;
  left: 6%;
}

.grid {
  width: 100%;
  margin: 1.5rem 0;
}

.grid-item {
  width: 33.33%;
  padding: 1rem 1.2rem;
  display: flex;
  justify-content: center;
}
.......[truncated for brevity]......
.more-folio {
      display: flex;
      justify-content: center;
}
<div class="grid-item logo-design">
  <div class="gallery-image">
    <img src="./img/portfolio/port1.jpg" alt="">
    <div class="img-overlay">
      <div class="plus">
        <div class="img-description">
          <h3>Logo Design</h3>
          <h5>View Demo</h5>
        </div>
      </div>
    </div>
  </div>
</div>

Answer №1

Update the styles for .img-overlay .plus:

.overlay.overlay-sm .shape {
  filter: brightness(0) invert(1);
  opacity: 0.15;
  height: 40px;
}

.overlay.overlay-sm .shape.wave {
  height: initial;
  width: 70px;
}

.overlay.overlay-sm .shape.xshape {
  height: 30px;
}

.portfolio .square {
  top: 28%;
  left: 20%;
}

.portfolio .circle {
  top: 8%;
  right: 35%;
}

.portfolio .triangle {
  top: 10%;
  right: 4%;
}

.portfolio .half-circle1 {
  bottom: 13%;
  left: 5%;
}

.portfolio .half-circle2 {
  bottom: 35%;
  left: 20%;
}

.portfolio .xshape {
  bottom: 10%;
  left: 8%;
}

.portfolio .wave {
  bottom: 38%;
  left: 6%;
}

.grid {
  width: 100%;
  margin: 1.5rem 0;
}

.grid-item {
  width: 33.33%;
  padding: 1rem 1.2rem;
  display: flex;
  justify-content: center;
}

.gallery-image {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  height: 330px;
  width: 100%;
  cursor: pointer;
  /* justify-content: flex-end; */
}

.gallery-image img {
  position: absolute;
  height: 115%;
  width: initial;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center;
  /* justify-content: flex-end; */
  /* cursor: pointer; */
}

.gallery-image .img-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  margin: auto;
  z-index: 2;
  color: var(--light-one);
  background-color: rgba(120, 76, 251, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 2rem 3.2rem;
  /* opacity: 0; */ /* I removed this one :: Rickard */ 
}

.plus:before,
.plus:after {
  content: "";
  position: absolute;
  width: 4.5rem;
  height: 3px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--light-one);
  border-radius: 3px;
}

.plus:before {
  transform: translate(-50%, -50%) rotate(-90deg);
}

.img-description {
  width: 100%;
}

.img-overlay h3 {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 1.5rem;
}

.img-overlay h5 {
  font-size: 1.15rem;
  font-weight: 300;
}

.gallery-image:hover .img-overlay {
  opacity: 1;
  transition: 0.3s ease;
}

.gallery-image:hover img {
  transform: translate(-50%, -50%) scale(1.1);
}

.more-folio {
  display: flex;
  justify-content: center;
}
<div class="grid-item logo-design">
  <div class="gallery-image">
    <img src="https://source.unsplash.com/random/300x200" alt="">
    <div class="img-overlay">
      <div class="plus updated">
        <div class="img-description">
          <h3>Logo Design</h3>
          <h5>View Demo</h5>
        </div>
      </div>
    </div>
  </div>
</div>

Answer №2

If you're looking to add text over an image, here's a method I would suggest:

.gallery-image {
  border-radius: 16px;
  min-height: 330px;
  cursor: pointer;
  background: center / cover no-repeat url("https://source.unsplash.com/random/300x200");
}

.gallery-image .img-overlay {
  display: grid;
  place-content: end center;
  min-height: inherit;
  border-radius: inherit;
  color: var(--light-one, #fff);
  background-color: rgb(120 76 251 / 0.55);
}

.img-overlay h3 {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 1.5rem;
}

.img-overlay h5 {
  font-size: 1.15rem;
  font-weight: 300;
}
<div class="gallery-image">
  <div class="img-overlay">
    <h3>Logo Design</h3>
    <h5>View Demo</h5>
  </div>
</div>

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

Is it possible to change the style of an element when I hover over one of its children?

Encountered an issue while working with HTML and CSS: //HTML <div> <div class="sibling-hover">hover over me</div> </div> <div class="parent"> <div>should disappear</div> </div> ...

Crafting an interactive saturation effect for mouseover interactions in a circular design

I'm looking to create a unique hover effect for my images. I have both a desaturated version and a full color version of the same image. My idea is to have mousing over the desaturated image reveal a circle spotlighting the color version underneath, a ...

Why isn't jQuery working properly for showing/hiding elements?

I am attempting to create a functionality where the string remove field can be toggled to show or hide using a single button, depending on its current state. Initially, it should be hidden (using the hidden HTML attribute), and upon clicking the button, it ...

Retrieve text from an element using jQuery when triggering "mouseenter" on a different element

Is there a way to retrieve the text from an element while simultaneously triggering a 'hover' action on another element? Here is an illustration: I am trying to gather all available colors, but the color names are only visible upon hovering ove ...

Click on the header to activate the accordion link with a trigger

I am having an issue with a trigger. My goal is to make the accordions collapse not only by clicking on the link, but also by clicking on the entire header panel. Below is my header's code: <div class="accordion-head" role="tab"> <div cl ...

Phonegap application functioning smoothly on computer, encountering issues on mobile device

Hey there! I recently developed a phonegap app that retrieves JSON data from a YQL link and presents it to the user. It works perfectly on Google Chrome desktop, but my client mentioned that it doesn't work on his Android 2.3 device. Could you help me ...

Ensuring input boxes are neatly positioned underneath one another, regardless of the chosen font size

Is there a way in CSS to ensure that these input boxes are always aligned below each other, regardless of font family, size, or window movement by the user? https://i.stack.imgur.com/Zbadh.png Currently, I am using the following approach: tab1 { paddi ...

Bootstrap 5's h-100 feature functions flawlessly in Chrome, however, it encounters issues when used with a group

Can you please refer to this question: Issue with Aspect Ratio of Images in Bootstrap 5 due to Padding After applying the h-100 solution, everything looks great on Chrome. Unfortunately, when I check it in Safari, the aspect ratio of the image gets distor ...

Angular 8 dropdown menu that closes when clicking outside of it

Hello, I am currently using the click function on the p tag. When a user opens the dropdown menu, I want to close it when they click outside of it in Angular. Here is the HTML code: <div class="select_cat"> <p class="cat_name" (click)="openC ...

Safari does not support SVG fill pattern, unlike Firefox and Chrome

Having an issue with Safari 6.1.5 not displaying a pattern in an SVG rectangle. After simplifying the code, here is the test case: <html> <head> <style> .patterned { fill: url("#myid") none; stroke:blue} ...

Dragging and arranging elements outside the main container is possible with drag-and

Imagine we have a div grid for an inventory that is 128x512px. I am looking to make all the (item 64x64px) divs draggable so they can be snapped onto the grid by dragging them. Inside the inventory, the divs must also be sortable without the use of lists ...

Executing HTTP requests in ngrx-effects

I'm currently working on an Angular REST application using ngrx/effects and referencing the example application available on GIT. I am facing challenges while trying to replace hardcoded JSON data in effects with data from an HTTP REST endpoint. The e ...

HTML script tag failing to load

As a beginner in using scripts in HTML, I'm currently following a tutorial that suggests loading the script after the body for certain reasons. In my own code, I found that I need to place the script both in the head section and after the body. Remov ...

Remove a Row from a Table by Clicking a Button with Ajax

I currently have an HTML table with 4 columns: SKU Group, Group_ID, Edit button, and Delete button. My focus at the moment is on implementing the delete functionality. I want it so that when the delete button is clicked, a confirmation box appears. If "OK" ...

How can the "Search within page" feature locate words that are divided between different elements?

I need to present text in groups of a specific length while still being able to search for text that spans multiple groups on the page. Additionally, I want to include a character above each group. My current approach is as follows: body { marg ...

The AJAX functionality seems to have broken following the switch from php5 to php7

When I initially wrote my code in php5, the index page would make an ajax call to check if $_SESSION['user'] was stored. If a session existed, the user's information would be displayed; otherwise, the page would redirect to the login page. H ...

Express app unable to retrieve dropdown menu data using Node.js BodyParser

I am currently working on creating a pug file for a signup form and I'm encountering an issue with the drop-down menu not functioning. How can I properly include my drop-down menu in the body parser? I initially assumed it would be processed with json ...

Using Angular 2 to toggle visibility based on a select box's value

<div class="form-group"> <label class="col-md-4 control-label" for="is_present">Is Present?</label> <div class="col-md-4"> <select id="is_present" name="is_present" class="form-control" *ngIf="candidates.is_present === tr ...

After sending a test email, inline CSS in Gmail seems to be functioning to some extent

While working on applying inline CSS styling to HTML for email, I have encountered an issue where the styling partially works when sending a test email. Can anyone provide guidance on how to resolve this problem? Steps to reproduce: Step 1 - apply CSS st ...

Should PHP be avoided in CSS files?

I've recently developed a CSS page named style.php and at the beginning, I included this line: <?php header("Content-type: text/css"); ?> What are your thoughts on this approach? Is it considered a bad idea? The reason behind doing this is tha ...