Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding images in JSfiddle [closed]

I want to create a fiddle in which i have to add an image.. (as a background image to a div)

I tried using add resource on the left but it does not work , I also tried to give complete path of the image in my folder structure but this also did not work out..

Does anybody know how to do it?

like image 420
user1079065 Avatar asked Nov 01 '12 07:11

user1079065


People also ask

How do I make JSFiddle full screen?

Right-Click the result window in Jsfiddle. Select "This Frame" Select "Show Only This Frame" Page will reload with result only in full screen (without a "run this fiddle" banner in it.)

What does the tidy button do in JSFiddle?

You can press the Tidy button on the top panel at any time and align all the lines automatically.

Is JSFiddle free?

jsFiddle is a free code-sharing tool that allows you to edit, share, execute and debug Web code within a browser.


3 Answers

You cannot link your LOCAL image to a website, first upload your image to some image uploading service and than use the path in your jsfiddle

Example

Upload your image to some image uploading service for example postimage

After uploading your image, copy paste the url in your jsfiddle and it will work...

like image 154
Mr. Alien Avatar answered Oct 10 '22 02:10

Mr. Alien


Use a base64 encoded image:

background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAA9CAYAAACEAXQxAAAM+klEQVR4nO1dzWscxxL37f0FIXfzDr5vCLl7LjmbvQZCYCE5xGAIAz6Y2BBYolwU/DDjJAbFYKJJSNiT5UyCFxwFGdbxJrFAZjORJRxkO2gkLKLFxpp6B7kmNT3VHzO7s9KK+kFftP1RU12/7urqmtExOMRIN1chvT0H6XdnIN1cPWhxBIKpxbGDFoBDunAB0osnIZ15DdKzr+yX3zoHLZZAMLU4nET/4tS/BMfSnT1osQSCqcXhJPrChSLRr71z0GIJBFOLw0n03zpFol88edBiCQRTi4kRPV35BtJh4lb3Yb9I9Av/hXR3q2YpBYKjidqJnm7FsDf/Jux9/B/Y6551a7O7tU9slewP+zVLKxAcTdRK9LT/GezNvrpP8pcl3bjj1vbiySLRb8/VKa5AcGRRG9HTjTs5gmclOOHW/to7RaIvXKhLXIHgSKPWHX1v4T2e7AvvWdum3dki0b84Vae4AsGRRb2u+zCBveAES/Z09Qdz20G3S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2t8NCdK4vLtW4ir7prk3ti4uNlNWBCVNJdDWTTQfuGs6WMONKdDrR6kQgSVz6UIF96hYJSkD1SMK52O12O3OROfLqjEiXWmp6Jm58TDyiWYG4QLpk3o2T6Kr+8HmiKMq9rMSRzvO87FnCMGTda84D1O3U3EJuy14cBQWiH5aiQ5Ik2ZtWJgWYMtfQmDgXmE6y6Q0uajCqMfZ6vVwWm0pojOij8VDYxqYeg7obu+R9q8arO15wCSE6A+V0p5JAl6ZKn3MSRDclq9BnK5Ozj/NcRiecR8MtCmqAryqmjuiURPgWGH7pEwNx1Fi4dFFKCHwTjWY10UlW+2+3204vGlCDajQa4Ps+BEFQiKiWyXVHUINQ65nOeioRbHnTXCTdtruYiMTJMGmim/LpKdG5dF1dsWXvqfbiGii1LaxlMHVER4XYJgHJpZsAlRDUMGyTjC4xd0an4Fw8dRJdc90paHxAFwE3jWvzhqieXQy07HPrZJgE0QH0r/KqpMKcdtO36Ew2hlAXTBN5Vb1VfYlFxVQSHQCy+0dMLGm1WtBqtcD3fesLKQg8b+GOrfaPyQy0b5qJh21t0fkwDHMy4rmZA36L3CY/PrtufNO4Za79cIwgCEoZHdUfyoD6M8lAv8du0y0F1Qc3n5x89DpW93ycnal2YAMmwLjMbRRFubpVX2JR8X9k3+VHV8wfTwAAAABJRU5ErkJggg==) 

It will slow down the load time of your fiddle if you overuse it but shouldn't be a big deal since its only a fiddle.

There are sites that will convert your local images to base64 for free: Base64 Encode

like image 35
Preston S Avatar answered Oct 10 '22 03:10

Preston S


like this add full url path to background-image

div{
    height: 619px;
    width: 780px;
    background-image: url(https://www.webkit.org/blog-files/acid3-100.png);
}​
like image 43
Pragnesh Chauhan Avatar answered Oct 10 '22 03:10

Pragnesh Chauhan