how to put background image path from remote web site? - html

I need grab images from Imgur to My web page background image
<div style="background-image:url(); width:100%; height:100%;" class="zoom" >
My image path is https://imgur.com/a/NbUpX
then how can I put this image to my background image url?

You need to copy the right image path: https://i.imgur.com/QdMWFHZ.jpg
Go to https://imgur.com/a/NbUpX -> right click on image -> Copy image address
After this you need to put it into background-image:url('https://i.imgur.com/QdMWFHZ.jpg');
Here you can find some documentation for background-image using.
Remember to set an height for your div, because in your solution will be 100% of nothing so this can be a solution:
<div style="background-image:url('https://i.imgur.com/QdMWFHZ.jpg'); width:100%; height:200px; background-size: contain; background-repeat: no-repeat;" class="zoom" >

Update image url like this
<div style="background-image:url('https://i.imgur.com/QdMWFHZ.jpg'); background-repeat:no-repeat; width:100%; height:100%;" class="zoom" >

Open your image path, after that right click on the image and click "Copy image address".
And then paste address on your code.
<div style="background-image:url(https://i.imgur.com/QdMWFHZ.jpg); width:100%; height:100%;" class="zoom" >

or in your CSS directly as background-image: url("https://i.imgur.com/QdMWFHZ.jpg")
since you need background of webpage it would be part of the body attribute like (CSS):
body {
background-image: url("https://i.imgur.com/QdMWFHZ.jpg")
}
You can test it here

Related

Image not displaying in html, but displaying in browser

I have an image with URL
http://nba2kcontest.com/fantasy/img/player.png
It is visible when I directly go to this URL, but not when I use html img tag it is not displaying:
<img src="http://nba2kcontest.com/fantasy/img/player.png">
I don't know what is the problem because the permission is also 0777
Edit
I don't know what but when I replace the picture player.png with player.svg it works!
Give the below a shot, maybe you have a background color set on a parent container that is making your png not visible.
.img-container{
background:#fff;
padding:10px
}
<div class="img-container">
<img src="http://nba2kcontest.com/fantasy/img/player.png">
</div>

Image map on home page responsive center

I've been reading this forum for a while now and decided that I might find help on this one because I couldn't find any exact answer.
I want to make a landing page with a big photo and put a responsive image map on it. I can make a map, I can put an image but the problems start when I want to make it responsive while the image stays centered (background-position: center). If I don't use the background-position:center the image is looking really small on mobile and it won't work like this.
I know that I can try putting a transparent image on the background but I don't know how to make the map responsive then.
Here is the link to my work site if you can help me http://www.mafia.brandscatter.com/
How about something like this?
https://jsfiddle.net/Lj0w9dnf/1/
.background{
background-color:red;
width:100%;
height:100vh;
padding:25%;
}
.map{
background-color:blue;
height:100%;
width:100%;
}
<div class="background">
<div class="map">
</div>
</div>

Ionic background img on div not loading LOCAL images but loads images from internet urls

I have this div which is loading perfectly image url from the internet but not my local image, very weird:
<div class="col biggest-grid dir-medico-grid" ng-click="showDirMedico()">
<img src="../img/dirmedico.png" class="img"/>
<p>DIRECTORIO MÉDICO</p>
</div>
So when I try this it works with no problem:
.dir-medico-grid{
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/652/confectionary.png);
}
but if I try this:
.dir-medico-grid{
background: url(../www/img/doctors.jpg);
}
Now it doesn't work as you can se my path is correct i'm going from ionic.app.scss to doctors.jpg:
I have tried with background: url(../www/img/doctors.jpg) no-repeat center center fixed;, with '../www/img/doctors.jpg' and "../www/img/doctors.jpg" with background-imageinstead of background but nothing seems to work this is very weird.
Use only img/dirmedico.png in html
<img src="img/dirmedico.png" class="img"/>
And for css
.dir-medico-grid{
background: url("../img/doctors.jpg");
}
The thing is for html, all templates are rendered on index.html which is in same directory with img.

Background Image not displayed in html

<body>
<div>
<div class="page1">
</div>
</body>
.page1{
background-image:url(../images/1.jpg);
background-size:cover;
background-position:center;
width:100%;
height:100%;
display:block;
position:relative;
}
This is my code for setting a background image for a webpage, but unfortunately it's not displayed. Can someone help me correct this code?
Ok I understand now, you need to do
html, body{
height: 100%;
width: 100%;
}
Background is not showing because your div needs content.
2 options:
You can set the background for body instead.
body{
background-image:url(../images/1.jpg);
}
Or set the height of the div to the height of the image
First of all you need to put a closing </div>
<div>
<div class="page1"></div>
</div>
The problem now is tha your <div class="page1"></div> is emptry. You need to put some elements inside so that the image can be displayed.
DEMO
Maybe you html document is not well formed.
Try this:
<html>
<head>
<-- style block have to be contained within a <style> tag -->
<style>
.page1{
background-image:url(../images/1.jpg);
background-size:cover;
background-position:center;
width:100%;
height:100%;
display:block;
position:relative;
}
</style>
</head>
<body>
<div>
<div class="page1">
</div>
</div> <-- this tag was missing in your question -->
</body>
Second possibility, your image is not properly linked. The way it is written, it is in a folder 'images' parrallel to the one you html document is hold. So, find what relativity there is between your document and the image and try modifying it's source url(../images/1.jpg); .
When defining the path to another object, I find it easier to define the file path using ~/f1/f2/file rather than trying to work from the current directory using ../f1/f2/file. What the ~ indicates is to start at the top level directory and work its way down the file structure. Much easier.

Overlaying text on the upper right corner of a background image

I am wondering how is it possible to achieve notification count as we see in linked (as shown in image below)
I have tried implementing a similar solutions, using a Span which has a background image and then using tag along with it.
Roughly,
<span class="message-icon" title="Unread Message" style="display: inline-block"></span><span style="background-color: red"><sup><b>5</b></sup></span>
this is no where near to what is there on linkedin's site.
Is there a cooked solution already available for it? Or any Ideas how it can be achieved?
Take a look at this: http://jsfiddle.net/D3VVv/1/
From this post: How can i overlay an 10x10px image on top of another image?
If you make the div that contains the message icon as big as the message icon + the notification icon, then you can position the notification icon in the top right corner of that div using absolute positioning. As is shown in the fiddle.
There are a few ways, here is an example of absolute positioning:
http://jsfiddle.net/e2Zs4/
HTML
<div class="con">
<img src="http://www.pictures-of-kittens-and-cats.com/images/cute-kitten-pictures-002-small.jpg" />
<img class ="number" src="http://www.privatefly.com/export/PrivateFly/.content/images/services/red_numbers_4.gif " />
</div>
CSS
.con { width:100px; height:100px; position:relative; }
.number { position:absolute; top:10px; right:10px; }