Tags down


Relative and absolute align

By : Abdulqadir Dula
Date : May 03 2020, 07:21 AM

the Parent div is not aligned on the bottom edge of image.

I know that I can add a padding but this is not the solution if you have dynamic resize.

You can see how it's behave on the image it's  not working :


.avatar-image {
  position: relative;
  text-align: left;
  color: white;

.botoom-menu {
  bottom: 0px;
  left: 0px;
  height: 30px;
  width: 100px;
  background-color: rgb(29, 228, 62);
  opacity: 1;
  position: absolute;

<div class="avatar-image">
  <img src="https://upload.wikimedia.org/wikipedia/commons/e/ec/Himmelsblau.jpg" width="300px" height="300px" alt="tttt" />
  <div class="botoom-menu" /> tests

How to align it correctly?

Answer :

Images are inline elements by default.

that means they behave just like other inline elements like text. Text needs a line-height, this means the image also needs an line-height. You can fix this issue by setting line-height: 0; on the image but this doesn't really solve the root cause of the issue. Instead, set display: block; on the image to display it as block level element.

try this code :

.avatar-image img {
  display: block;

Share : facebook icon twitter icon
Related Posts Related Posts :
  • clear array after form submit
  • pass url variable to javascript
  • access data using api
  • div position fixed css
  • add horizontal line between two div
  • disable toggle button css
  • css fixed line height
  • background image not working
  • table cell border
  • text line break css
  • overlay div on div
  • text direction rtl css
  • javascript convert string to an object
  • bind inner div click to outer div
  • jquery ajax oncomplete
  • how to use promise in for loop
  • jquery get element using variable
  • javascript send textbox value
  • pass div class content to another class or id
  • css new line after element
  • css calc not working properly
  • link disabled jquery
  • sql join table to subquery
  • MS Access SQL Issue with OR AND Operators
  • set textarea value using php
  • php merge two arrays into one
  • php form with google captcha
  • update current row in php
  • php date format mysql
  • mysql pdo select query
  • php function return an array
  • PHP mysqldump database to sql file
  • display image query
  • php create array using foreach loop
  • associative array php
  • group_concat in mysql laravel
  • php array_push empty
  • mysql on update cascade not working
  • pdo insert prepared statement
  • mysql insert ignore vs on duplicate key
  • mysql insert into existing row
  • mysql multi insert query
  • mysql group by show all rows
  • php change profile image
  • combine multiple arrays into one array php
  • how to sum values in an array
  • how to get sum of the total time
  • How to Create Facebook live stream without notification using API ?
  • on button click make div visible
  • css affect another element on hover
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org