How I write a text into a photo?
<img src"photo.png" />TEXT
I have to do with css position absolute and relative? I know it works with position absolute and relative but it is another way to do and how is the best way? If is the only way with position absolute and relative, position relative must be the main photo and position absolute the content(TEXT) ?
you can do like this
<img src="http://upload.wikimedia.org/wikipedia/commons/5/5a/SMirC-hi.svg" /><div style="position:relative; left:120px;top:-150px">TEXT</div>
for demo
http://jsfiddle.net/5CSej/
try something like this,but this is with absolute and relative
<tr>
<div class="image">
<img alt="" src="http://www.YourDomain.com/img/yourImage.jpg" />
<div class="text">
<p>This is some demonstration text</p>
<p>This is some more wonderful text</p>
</div>
</div>
</tr>
ur css
.image {
position:relative;
}
.image .text {
position:absolute;
top:10px;
left:10px;
width:300px;
}
This will place text directly on an image
okay, here is another method to add a text over the image..the condition is you have to use a background image. Here is the Demo.
div:before{
content: "";
position:absolute;
background:url('http://lorempixel.com/400/400') no-repeat;
width:400px; height:400px;
z-index:-1;
}
<div><h1>Look at ME!</h1></div>
Related
In the codes below, I have two <div> tags. I want to align one <div> to the left and the other to the right, with the same height and width. Please help me to do this.
<div id="imgShow">
<panel>
<img class = "hidden" id="orginal" alt = "Goofy pic of me" runat="server" />
<div id="ScrollImg" style="position:relative;width:900px; height:330px;overflow: scroll; top: 3px; left: -1px;left:auto">
<canvas id = "drawing" height="1500" width="1200" >
<p>Canvas not supported</p>
</canvas>
</div>
</panel>
</div>
<div id="divComplete" style="position:relative;width:100px; height:330px;overflow: scroll; top: 3px; right: -1px;right:auto"></div>
Set the floats for each div with CSS: example
.left { width:50%; float:left; height:200px; background:red;}
.right { width:50%; float: right; height:200px; background: blue;}
Try below code:
Demo
<div id="imgShow" style="width:50%; height:330px;overflow: scroll;float:left;">
<panel>
<img class = "hidden" id="orginal" alt = "Goofy pic of me" runat="server" />
<div id="ScrollImg">
<canvas id = "drawing" height="1500" width="1200" >
<p>Canvas not supported</p>
</canvas>
</div>
</panel>
</div>
<div id="divComplete" style="width:50%; height:330px;overflow: scroll;">Canvas not supported</div>
You should use floats:
<style>
#imgShow, #divComplete{
float:left;
width:50%;
}
</style>
If you want both at different widths, simply separate the css selectors and add the desired width.
PS: Avoid using inline CSS unless you need to, transfer these to a separate CSS file and include it in the head section
You can use twitter bootstrap css for styling your divs. Simply addclass="col-xs-6" to each div. Remember class="col-xs-12" is the full width that the div can take based on the width of the parent container. Using -xs- instead of -md- shrinks the div upon resize instead of knocking them down. If you want margins simply add change them to col-xs-5s then add a col-xs-2 div in between. It's also good practice to use parent divs with container-fluid and row classes
This should be a quick question i think. I am trying to create a simple overlay over a div using hover. This half works, because the image does not get covered.
<div class="puzzlePieceContainer">
<img class="back-link puzzleTileBack-4" style="display: none; margin-left: 0px;" alt="" />
<div class="boxShadow arrowMargin">
<div class="overlayContainer overlayBox">
<div id="puzzleTile-4" class="puzzleTiles">
<img src="http://debtsettlementlogic.com/wp-content/uploads/2013/09/debt-solutions-florida.jpg" alt="" width="300" height="199" />
<h2 style="padding-top: 10px;">Solutions</h2>
</div>
</div>
</div>
</div>
CSS:
.overlayBox:hover
{
background:rgba(0,0,0,.15);
}
Here is my fiddle: http://jsfiddle.net/3aRY4/
How do I get the effect that the overlay covers the entire div, and not just everything around the picture?
One approach would be to add the overlay via a pseudo element. Just absolutely position the pseudo element relative to the parent and have it cover the entire element.
Updated Example
.overlayBox {
position:relative;
}
.overlayBox:hover:after {
content:'';
position:absolute;
background:rgba(0, 0, 0, .15);
top:0; bottom:0;
left:0; right:0;
}
I have an image in my HTML code:
<img src="main.jpg" />
I want to show a smaller linkable image over main.jpg when I hold mouse over main.jpg.
(This image is link)
I prefer to use smaller image by CSS.
I tried this:
<div class="img"><img src="main.jpg" /></div>
<div class="resize">resize imgae</div>
.resize{
background:url(resize.jpg) left top no-repeat;
position:absolute;
top:0;
left:0;
desiplay:none;
text-indent: -9999px;
}
I want do this just with pure CSS (no JS)...Do you know a trick or an alternative way to do it?
this will solve your problem
<div class="img">
<img src="main.jpg" />
<div class="resize">resize imgae</div>
</div>
Also correct your css class
change desiplay:none; to display:none;
I'd like to be able to position an image (blue) so that what ever size it is, it is always centered relative to the baseline of the div behind (red, not the containing div). The div behind will always be the same size/position.
Preferably this would be using css only as I'm using drupal and I don't know much about editing beyond the tpl files.
Thanks!
EDIT: Here's the layout http://pastebin.com/SisQHM4y
Hi you can do this pure css as like this
css
.wraptocenter {
display: table-cell;
text-align: center;
vertical-align: middle;
width: 500px;
height: 400px;
background:green;
}
HTML
<div class="wraptocenter"><img src="//?" alt="images" /></div>
Live demo http://jsfiddle.net/rohitazad/tvrMp/
More information about this http://www.brunildo.org/test/img_center.html
Perhaps something like this:
<style>
#blue { margin-left:auto;margin-right:auto; }
</style>
<div id="red">
<div id="blue">
<img src="?" id="myImg" />
</div>
</div>
EDIT
I see, so you wish to center the x-axis horizontally, not vertically. And that link is a little messy. Perhaps you could try to
<style>
.user-picture { margin-top: auto; margin-bottom: auto; }
</style>
<div class="content">
<div class="profile" typeof="sioc:UserAccount" about="/users/diver1">
<div class="user-picture">
<a href="/users/diver1" title="View user profile." class="active">
<img typeof="foaf:Image" src="http://waterworksworldwide.com/sites/default/files/pictures/picture-126-1333572014.gif" alt="Diver1's picture" title="Diver1's picture" />
</a>
</div>
</div>
I am still having a little bit of a hard time seeing where the overlap between areas is as suggested by the red and blue in the question. If there is no overlap with my suggestion then please let me know and perhaps we can try to use some variations with position: absolute;
I have the following code:
what i want is using css put the "MYIMAGE" on the most right side.
alt text http://igurr.com/resized-image.ashx/__size/500x400/__key/CommunityServer.Components.PostAttachments/00.00.00.01.73/OneContact.JPG
<div style="cursor: pointer;" onclick="javascript:SelectContact('17');" onmouseover="javascript:this.className='onfocus';" onmouseout="javascript:this.className='tempClass';" id="contact_17" class="tempClass">
<input type="checkbox" class="contactChk contactItem" id="chk_17" name="chkContact" onclick="javascript:alert('clicked');"/>
<img height="25" width="25" class="contactItem" src="Images/Contacts/NoImage.gif" alt=""/>
<span class="contactName" id="contactName_17">
Amr ElGarhy
</span>
<img id="MYIMAGE" src="Images/Common/Motiva.png" alt="" class="contactItem"/>
<br/>
</div>
CSS:
.contactChk {
margin-left:10px;
}
.contactItem {
display:inline;
vertical-align:middle;
}
.contactName {
display:inline;
vertical-align:middle;
}
An alternative is to use absolute positioning.
If #contact_17 is position:relative, you can set #MYIMAGE to position:absolute and set its 'right' property to 0 (or however far from the right edge you desire). Absolute positioning will ignore anything else in the div, though, so if you do that be sure to set the rest of the contents to not overlap.
Try:
img#MYIMAGE {
float: right;
}
Not sure if that'll work - it depends on how div#contact_17 is styled, which isn't clear from your question.
Just float it right
#MYIMAGE{
float:right;
}
It would be a good idea to fix the width of the image too.
Try float:right;