Solved

Add two pictures on top of each other in html

Posted on 2013-10-25
3
268 Views
Last Modified: 2013-10-28
I am working on a html page and has a topbar with a background pattern and then some specialy styled text in the form of a .png file. The background pattern is also a .png file.

How do I add them so that the background.png becomes the background in the frame and the text.png will be displayed on top of the pattern file. Somehow the pattern need to show through where there is no text in the text.png.
0
Comment
Question by:mdoland
  • 2
3 Comments
 
LVL 7

Expert Comment

by:Ironhoofs
ID: 39599918
That will only work if text.png has a transparent background. If text.png has a solid background, there is little you can do with HTML to change that.
0
 
LVL 7

Expert Comment

by:Ironhoofs
ID: 39599939
Talking about the HTML, this is an example of how you could do it:

<html>
<body background="https://fbcdn-dragon-a.akamaihd.net/cfs-ak-ash3/84979/417/388809427820169_484552950.png">
  <img src="http://overshoot.tv/sites/overshoot.tv/files/black-on-transparent.png">
</body>
</html>

Open in new window

0
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 500 total points
ID: 39600035
You can also set the images position as absolute inside a relative container:
<div style="position:relative;">
     <img style="position:absolute; left:0; top:0;" src="background image url" />
     <img style="position:absolute; left:0; top:0;z-index:1" src="text image url" />
</div>

Open in new window

With this you can accurately change the position of the images.
Still the text image needs to have a transparent background.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
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 a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
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…

706 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

12 Experts available now in Live!

Get 1:1 Help Now