How to integrate a html code and widgets into a picture - html

I want to introduce/insert a html code and a widget into a picture, something like a paypal button and a time coundown . In witch way it is possible to do that ?.
I appreciate every answer. Please give me some tips.

Give some other clues mate.
From what you rote, I think that you can accomplish that just with a little css.
Let's say, the image on css's z-index 5, and the content that you want to place over it on z-index 6, 7, 10, doesn't mind as long it's greater than the z-index of the image.
Then, the counter, just google a little and you'll find plenty tutorials about javascript countdowns.

As I said. Use z-index css propperty.
Take a div, set it to the image exact size, then with margins and z-index, place the counter on top of it.
As an example:
<div id="image">
<div id="progress"> ... </div>
</div>
Where the css for each would be:
#image{
width: 400px;
height: 500px;
z-index: 0;
}
#progress {
z-index:10;
margin-bottom: 20px;
}
The width and height propperties should be the image's size ones. The rest it's up to where excactly are you gonna place this code.

Related

Overlay image into another div

if you could take a look for a moment at http://www.acehbus.com, you could see that the screenshot image of iPhone is fully seen in the screen. I want to know how to make the half of the image overlays the next div like in the http://sociali.st. I have tried z-index but it doesn't work. Thanks you for your help.
I got through your site, and I have two things:
1) dont use images with resolution of 649x1323. Half of that size will ok .. there are many of images of this phone, and people with slower connection will die on this. And it is still used only as smaller thumbs, so large resolutions are really not necessary.
2) You use the image as itself. Use div instead and give image as its background. See this fiddle:
https://jsfiddle.net/8xhucpx8/
div.image{
width:300px;
height:200px;
background-image:url('http://www.acehbus.com/img/search.png');
background-position:top center;
background-size:100% auto;
background-repeat:no-repeat;}
You can do that using overflow: hidden first give a fixed height to the parent element of the image in your case col-md-6. So do something like.
.col-md-6 {
height: 155px;
overflow: hidden;
}
<div class="col-md-6">
<img src="http://www.acehbus.com/img/search.png" alt="" width="200px" />
</div>
First of all, you may always inspect a site with effect you want to achieve and try to apply it's approach in your project. The markup and styles are at direct access. If you noticed in the example you've provided the overlapping effect is achieved with combination of negative margins and absolute positioning. So if you play with these properties you gonna make it. I would go for something like this:
<div class="iphone"></div>
.iphone {
bottom: -100px;
position: relative;
}
Look, I made some experiments and made this fiddle

Image overlays,text on images and other effects through CSS or Photoshop?

I have been meaning to ask this for a long time so here it goes: I am new to the world of Web Design and I am currently working on my First Website. Its a Technology blog, I have thought of a grid layout for the same and now it works great.
However, The Grid that I am using consists of high resolution images related to the topic of the article. I have spend a lot of time searching for various effects on images like overlays(coloured and otherwise), text on images, the proper ways to use text on images etc. So I do think now i have enough knowledge regarding these effects to apply them to the website.
The problem is, I want to make the website responsive, so what happens is, the coloured overlays are rendered just fine on all devices but the text on images which is positioned absolutely just goes off the images sometimes, or sometimes it just isn't legible enough or sometimes it goes where I don't want it to go.
So my question to all of you is: Instead of doing all this with CSS, isnt it better to use an image editor like Photoshop or something and then just add these images to the grid?
It will scale much better with this technique? i am new to this so please if its something really obvious, then please try to explain.
Image with text are inflexible and maintainability is problematical as you need to change the image evry time you change the text.
A common technique is to wrap the image in a div that is shrink-wrapped to the size of the image and the position the overlay absolutely (after adding position:relative to the wrapping div.
Then you can add any text you like to the overlay and style it anyway you like...you can even fade it in and out.
Like so.
.wrap {
display: inline-block;
position: relative;
}
.wrap img {
display: block;
max-width: 100%;
height: auto;
}
.wrap .overlay {
position: absolute;
top:0;
left:0;
height: 100%;
width: 100%;
background: rgba(255,0,0,0.5);
text-align: center;
color:white;
transition: opacity .5s ease;
opacity:0;
}
.wrap:hover .overlay{
opacity:1;
}
<h2>Hover the image</h2>
<div class="wrap">
<img src="http://lorempixel.com/output/city-q-c-200-200-2.jpg" alt="" />
<div class="overlay">
<h3>Las Vegas</h3>
<p>A city dedicated to a good time</p>
</div>
</div>
Do you have some code that we can look at?
I have just done something similar with the text in the centre of the image on rollover within a div of it's own. This could be made to work in your case but you may need to alter the font-size on the smaller browsers so that the text stays where you are wanting this to go
In my experience it has always been best to use CSS to position the text on top of images. The best thing is to use W3 schools and other online tutorials maybe media queries to ensure the text does not go out of position. May take a bit of extra learning but will be worth it in the end.
I have always used Bootstrap for example, it has always been so much easier when it comes to responsive design.
Hope this helps.

Vertically position an image inside a div

I have a problem I'd like some help with. Thankfully my code can be flexible, so I'll just give some generic markup.
My major limitation (due to the way I am retrieving the information from a database) is that the images CANNOT be background images, otherwise this would be easy.
I simply want an image to change when I hover over it. I have made an image twice as high as I need it - half colour, half black and white. The idea is, the image is exactly the same (a person) - but when you hover over it - you see the colour version.
I have constructed my 'hover' image 200 pixels wide, and 400 pixels high. It is marked up very simply:
<div class='staff_profile'>
<h3>Staff Title</h3>
<div class='staff_image'>
<img src='.....' alt='....' />
</div>
</div>
So I am figuring I need something like:
.staff_image {
float: left;
height: 200px;
width: 200px;
}
The trouble is - using this, the 400px high image displays by default in the centre of that staff_image div - so I see half the black and white photo, and half the colour.
I am going to be using jQuery to do the hover - so just need some CSS tips on what properties I need to use to:
Have the image display at the very top
Have the image display from halfway down
Everything I try with padding and margin seems to push all content down, and doesn't move the actual picture inside at all. I basically need to know how to maneuver an image that is too tall for a fixed height div around WITHIN that div. And none of the answers I can find here seem to help. There are lots of them on centering an image - but centering is NOT what I want to do - it's the opposite! :)
Thanks for any help.
Here you go: http://jsfiddle.net/xqxSK/
<div class='staff_profile'>
<h3>Staff Title</h3>
<div class='staff_image'>
<img src='http://cdn.sstatic.net/stackoverflow/img/sprites.png?v=6' />
</div>
</div>
.staff_image {
overflow: hidden;
height: 200px;
}
.staff_image img {
position: relative;
}
.staff_image:hover img {
top: -200px;
}
I'm using CSS instead of jquery for the hover. This is a better approach, since it works better on touchscreen devices.

Keeping width/hight ratio and using div normally?

Im still having a bit trouble understanding my divs. Im trying to make a website that changes its sizes according to browser/screen size.
Ive gotten this far:
my html:
<div id="wrapper">
<div id="header">Header</div>
<div id="left">Left</div>
<div id="right">Right</div>
<div id="footer">Footer</div>
</div>
my css:
#wrapper{width: 60%;}
#header{width: 100%; padding-top: 11.00%;}
#left{float: left; width: 27.5%; padding-top: 44%;}
#right{float: left; width: 72.5%; padding-top: 44.00%;}
#footer{clear: both; width: 100%; padding-top: 11.40%;}
Now my divs are exactly the right size, the problem is that the conect is always at the bottom of the div but i need it to be like a normal div so i can do anything i want with it.
Whats the easiest way to use it like a normal div?
Thank you for any help! :)
Edit:
Here is what it looks like: http://jsfiddle.net/rswML/
... and as i said the problem is that the text is always at the bottom of the div. I understand its because of padding-top but i need it to keep the hight ratio to width andd still use the div normally.
What you are trying here is a responsive design concept. I advice you to try out bootstrap framework for this. Rather than doing everything by your own, you can get everything done by simply adding a class to your divs.
Responsive web design (RWD) is a web design approach aimed at crafting
sites to provide an optimal viewing experience—easy reading and
navigation with a minimum of resizing, panning, and scrolling—across a
wide range of devices
I think the issue may be with your padding values. Perhaps adjusting them will allow you to have the control you want or maybe a margin-top would be better. Also, not sure if you were hoping to line up the tops of the elements #left and #right but those padding settings may render at different values. The padding-top property with a percentage references the containing block's width. Hope that helps. Cheers.
The solution was that i had to make header divs position: relative and then make another div inside of it that was position: absolute and width/height: 100%.

Clip images with HTML and CSS

I want to display images in a 144px x 144px div element.
Images are always larger than 144px and so I want to zoom scale them. By that I mean that the smallest side will touch the edge of the div, cutting a bit from the other side - the opposite of letterbox.
How can I do this and have it work on older browsers like IE as well?
EDIT:
Changed the image, the first was wrong, sorry.
Resize the image so that inside the div there is no space without image
My first answer addressed intentionally blocking out the part of the image while intentionally keeping the space occupied. If you just want part of the image visible with no space or anything else taken up, the best option will be to use CSS Sprite techniques.
Here's an example:
HTML (copy and paste into your own file for a full test):
<html>
<head>
<style type="text/css">
.clippedImg {
background-image: url("http://www.grinderschool.com/images/top_main.jpg");
background-position: -75px -55px;
height: 100px;
width: 235px;
}
</style>
</head>
<body>
<div class='clippedImg'> </div>
</body>
</html>
CSS (this is really the key):
.clippedImg {
background-image: url("http://www.grinderschool.com/images/top_main.jpg");
background-position: -75px -55px;
}
You can adjust the position numbers to get exactly the portion and size of the image that you want.
Note also that if you want a black box around this, it's even easier than the other post I made. Just put a parent div around this one:
<div class='blackBox'>
<div class='clippedImg'> </div>
<div>
With a padding and width set to create the black-box effect you want:
.blackBox {
background-color: black;
padding: 0 20px;
width: 235px;
}
Set only the width of the image to 144px in CSS or in the attribute. The height will scale automatically. I'm fairly certain this works as low as IE 6. I'm not certain about anything older than that.
If I read your question right, you aren't trying to resize the image, but rather to actually cut off part of the image. If you just want to resize the image, then follow the other answers about that.
The simplest way I can think of to actually cut off the image this is to add <div class='blockOut'> </div> and then use CSS to place & size the div, make it's color match the background color of your page, and put it in front of the image. Example CSS:
.blockOut {
position: relative;
top: -100px;
left: 100px;
background-color: white;
z-index: 2; //this is the important part for putting this div in front of the other one
}
Edit: Note that since you added an example showing that you want all sides blacked out, this would require separate divs for blacking out the top, each side, and the bottom. Also, if you want part of the image to show through (as it does in your example) you can use CSS transparency options.
div{height:114px;width:114px;overflow:hidden;}
div img{position:relative;left:-100px /*or whatever you want. can change it with js*/;top:-100px;}
that is masking to only show a part of the img, as you say in the title. but in the description says you want to resize the img. decide yuorself
to do what you want with css, you should use max-height:144px;max-width:144px. but ie6 doesn't implements those simple properties, so you'll have to use js