• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: center div on top of img without using position

Resolved: center div on top of img without using position

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have a main container that contains an image and a div. What I want to achieve is to center the div on top of the image without having to use absolute or relative positioning on it. How can I achieve this? Thanks in advance.


Answer:

The only way I can think of without using absolute positioning or changing your markup is to use a CSS Grid and make both elements occupy the same cell.


If you have better answer, please add a comment about this, thank you!

html
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: The ‘Access-Control-Allow-Origin’ header contains multiple values ‘*, *’, but only one is allowed. cors error not resolving

02/04/2023

Resolved: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘crm.email’ doesn’t exist (Connection: mysql, SQL: select count(*) as aggregate from `email`

02/04/2023

Resolved: Regex: Curly braces in reverse? Match X characters before a string?

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.