Solved

Class Within A Class

Posted on 2013-05-23
4
246 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
Comment Utility
define a class for image and assign it to IMG tag.
0
 
LVL 51

Accepted Solution

by:
Julian Hansen earned 500 total points
Comment Utility
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
Comment Utility
>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
Comment Utility
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

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

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!
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.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

744 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

16 Experts available now in Live!

Get 1:1 Help Now