background-image

Add background image in SVG

无人久伴 提交于 2019-12-02 17:35:25
问题 I need to add background image in svg. But I'm getting only black rectangle box, the image is not displaying. How to add the background image? This is my code: <style> path { fill: none; stroke: #000; stroke-width: 3px; stroke-linejoin: round; stroke-linecap: round; } </style> <svg width="1000" height="700"> <!-- <rect fill="#fff" width="100%" height="100%"></rect> --> <defs> <pattern id="img1" patternUnits="userSpaceOnUse" x="0" y="0" width="1000" height="700"> <image xlink:href="home/nayana

Responsive background image in div full width

妖精的绣舞 提交于 2019-12-02 17:33:18
I'm trying to figure out how to make a background-image in a div full width and responsive. The background-image is expanding across the width of the page (and is responsive), but the height of the image isn't its full height. It seems like it's being cut-off somehow. I'm using bootstrap framework, and the reason I'm trying to do this is I want to overlay some text on the image. I've tried so many different things but cant seem to figure it out, help! <div class="bg-image"> <div class="container"> <div class="row-fluid"> <div class="span12"> <h1>This is some text</h1> </div> </div> </div> <

Is it possible to make a responsive div with a background-image that maintains the ratio of the background-image like with an <img>?

扶醉桌前 提交于 2019-12-02 17:20:43
Not a a native english speaker so there's probably a better way to shape the question...anyway: What I want to create is similar to the header here: http://thegreatdiscontent.com/adam-lisagor The header image is shown fully in all screensizes, and the aspect-ratio of the image is of course always correct. This is made using an and getting the text to appear on the using position: absolute. But if you use css for the background-image instead of an , you'll get something like this header: http://elegantthemes.com/preview/Harmony/ Resize browser to see parts of the background being left out. Is

Multiple background images positioning

邮差的信 提交于 2019-12-02 17:17:23
I've got three background images, all of width 643px. I want them to be set out like so: top image (12px height) no-repeat middle image repeat-y bottom image (12px height) no repeat I can't seem to do it without getting them to overlap (which is a problem because the images are partially transparent), is something like this possible? background-image: url(top.png), url(bottom.png), url(middle.png); background-repeat: no-repeat, no-repeat, repeat-y; background-position: left 0 top -12px, left 0 bottom -12px, left 0 top 0; Your problem is that the repeat-y is going to fill the whole height, no

:before and background-image… should it work?

五迷三道 提交于 2019-12-02 16:31:56
I've got a div and apply :before and :after an image as content. That works perfectly. Now I would need to apply a background image so it does repeat as the div resizes, but it does not seem to work. Is background image on :before and :after supposed to be working? The current code: HTML: <div id="videos-part">test</div> CSS: #videos-part{ background-color: #fff; height: 127px; width: 764px; margin: -6px 0 -1px 18px; position: relative; } #videos-part:before{ width: 16px; content: " "; background-image: url(/img/border-left3.png); position: absolute; left: -16px; top: -6px; } @michi; define

Check if Div with specific Class exists in the page

谁说我不能喝 提交于 2019-12-02 16:13:20
问题 I'm trying to modify an existing webpage by inserting my own Javascript file in it. I'm setting a background Image for this webpage by inserting a new Div through my Javascript and setting background of that div to image url. For centering this image on background and to make it occupy the whole webpage, I'm using 'background-size': 'cover' property. This of course doesn't work in older IE versions. I want to fix it, I'm thinking of zooming in the image by specific ratio calculated using page

CSS - Set Div Width 100% and Resize Keeping Aspect Ratio

余生长醉 提交于 2019-12-02 15:12:36
问题 I have a div with a background image that will overlay part of the header slideshow. I want the width of the div to always be 100% of the window size, even when the user re-sizes it. The height should change based on the aspect ratio of the background image. The dimensions of the background image is 1500x406. Here's the sample code: HTML <div id="wrapper" class="clearfix"> <div id="bg_img"></div> </div> CSS .clearfix { width: 100%; position: relative; display: block; margin: 0; padding: 0;

Background image doesn't show for header

自古美人都是妖i 提交于 2019-12-02 13:44:34
I have simple html page with body and header elements : <body> <header class="logoBar"></header> </body> I try to add background image to header . If i do: .logoBar { background:url('http://img704.imageshack.us/img704/2162/67726065.jpg') repeat-x center top; } It doesn't show image. But if i make: body { background:url('http://img704.imageshack.us/img704/2162/67726065.jpg') repeat-x center top; } I see image. Why doesn't it work for header ? Thank you. Try setting a width and height on your header element's css. .logoBar { width: 100%; height: 250px; <!-- Your image height goes here...

CSS or Javascript - display fallback text if background image not loaded [duplicate]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 13:07:32
This question already has an answer here: CSS background image alt attribute 10 answers How can I display text instead of logo, if the logo graphic file isn't loaded or missing? I have div with background PNG image: <div class="iHaveBgImage"> this text should be displayed if bg image is not loaded </div> .iHaveBgImage { background-image: url('img.png') } It doesn't have to be pure CSS, Javascript solution is allowed. I was thinking of onerror event, but it works with images, not elements that have image backgrounds. EDIT: I was told this has been answered before, but there is another situation

background-image animation not working in Firefox

此生再无相见时 提交于 2019-12-02 12:16:22
问题 I am using the following script to animate a sprite for the background-image for a nav div: $("li#test2").hover( function () { $(this).animate({ 'background-position-y': '-40' }, 500); }, function () { $(this).animate({ 'background-position-y': '0' }, 500); } ); This works fine in Safari and Chrome, but not in Firefox. You can see the page it is on here. Just hover over the first 'home' image in the nav bar. Could someone let me know why it's not working in Firefox? Thanks, Nick 回答1: