Solved

CSS and images

Posted on 2016-09-16
5
82 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
ID: 41802288
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
ID: 41802485
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 22

Expert Comment

by:Kim Walker
ID: 41803328
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 22

Expert Comment

by:Kim Walker
ID: 41803329
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
ID: 41805412
exactly what i was looking for!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
wordpress url rewriting plugin 5 41
Where to define breakpoints for responsive CSS 2 29
Tags from access to excel 3 24
Bad <form> statement? 9 20
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

947 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

21 Experts available now in Live!

Get 1:1 Help Now