/    Sign up×
Community /Pin to ProfileBookmark

DIV top centre of another DIV

I have a DIV, it’s a “card” on my homepage. 300px wide, 170px high. Has a background image.

I want to have a second div on top (z-index top) of this div and in the physical center and top of it. Fixed background color. Inside this dic I’ll have words etc.

Any Ideas?

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@kiwisauthorMay 16.2020 — Here's an example. As you can see, I have padding or margin at the top. No idea why

https://jsfiddle.net/nzkiwis/6tykeawu/
Copy linkTweet thisAlerts:
@kiwisauthorMay 16.2020 — Another attempt with nothing

https://jsfiddle.net/nzkiwis/m51punx0/4/
Copy linkTweet thisAlerts:
@SempervivumMay 16.2020 — This question is asked frequently and therefore I made this demo showing two procedures of placing an element above an image:

https://jsfiddle.net/Sempervivum/k84scz1a/29/

I've pointed out the pro's and con's for each.
Copy linkTweet thisAlerts:
@VITSUSAMay 16.2020 — @kiwis80#1618487 Can you please share screenshot which you have done code? After that we can suggest you best possibilities.
×

Success!

Help @kiwis spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...