Solved

Class Within A Class

Posted on 2013-05-23
4
248 Views
Last Modified: 2013-05-24
I have an image within a div.  The div is fairly transparent, however I don't waht the image in the div to be transparent.  Right now the image is currently taking on the attributes of the div.

<div class="container">
  <div class="content">
    <h1 align="left"><img src="Images/Page_Backgrounds/FlipBack.png" width="211" height="276" class="None" alt="Head" /></h1>
    </div>
    </div>

Open in new window

0
Comment
Question by:DS928
4 Comments
 
LVL 4

Expert Comment

by:mohammad827
ID: 39193388
define a class for image and assign it to IMG tag.
0
 
LVL 52

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 39193412
The reason for this is that the image is inside the div and will inherit its parents opacity.

One solution is to position the image over the div i.e
.container {
 position: relative;
 width: 500px;
  height: 500px;
}

#transparent-div {
  position: absolute;
  height: 100%;
  width: 100%;
  z-index: 1;
  background: blue;
  opacity: .75;
}
img {
	z-index: 100;
	position: absolute;
}

<div class="container">
   <div id="transparent-div"></div>
   <img src="images/00100.jpg" />
</div>

Open in new window

0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39194087
>I don't waht the image in the div to be transparent
Open up the image in your favorite image editing software and Save As/Export as a jpeg file or remove the transparency in the png.   But no use having a png if you don't need the transparency as the jpg will be smaller file.
0
 

Author Comment

by:DS928
ID: 39194614
I'm using the png because the background of the image is transparent, but the image itself should not be.  Tryimh above solution, now.  Thank you.
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

When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

895 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

14 Experts available now in Live!

Get 1:1 Help Now