Solved

CSS and images

Posted on 2016-09-16
5
70 Views
Last Modified: 2016-09-19
Im trying to figure out how to place a circle image on top of a 40px height background color.  The image is 175px high.  No matter what I try, I cannot seem to get it to lay on top of background.  See image for example.

example of end result
0
Comment
Question by:a204801
5 Comments
 
LVL 5

Accepted Solution

by:
ResQTek Nancy earned 500 total points
Comment Utility
You'll probably want to use two DIV containers with relative positioning to achieve this. One for the rectangle and one for the image. Then you adjust the distance from the top of the page.
Hard to say what you might be doing wrong without your code.
Official reference: http://www.w3schools.com/css/css_positioning.asp

I drew up something really raw in CSS that might help. http://staging.ResQTek.net/overlap.htm
0
 
LVL 19

Expert Comment

by:Iammontoya
Comment Utility
the code is helpful, but here's a way to look at it...

you have 40 pix high, but you want something that's 180 pix over it.

If I start with a div at 195 pix, put my image div 10px from top, then I'll have it centered top to bottom.
then, I center my border inside that (obviously the border would go second)
0
 
LVL 21

Expert Comment

by:Kim Walker
Comment Utility
The code is helpful. It has been said twice already, but it really is.

If you're trying to use z-index to bring the circle image to the top, beware that z-index only applies to positioned elements. You can always enter position: relative; without any top, right, bottom, or left properties in order to avoid moving the image.
#circle-image {
    position: relative;
    z-index: 1000;
}

Open in new window

0
 
LVL 21

Expert Comment

by:Kim Walker
Comment Utility
Another issue might be whether or not the area outside the circle in your image is white or transparent. Is it a GIF, PNG, or JPG?
0
 

Author Closing Comment

by:a204801
Comment Utility
exactly what i was looking for!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now