background-image

how to use correctly [ngStyle] with function

杀马特。学长 韩版系。学妹 提交于 2019-12-11 10:33:09
问题 I have the following error that constantly returns me the debug console HomeComponent.html:33 ERROR TypeError: Cannot read property 'url' of undefined at HomeComponent.getImageEvent (home.component.ts:73) at Object.eval [as updateDirectives] (HomeComponent.html:33) HomeComponent.html <div [ngStyle]="getImageEvent(i)"> home.component.ts getImageEvent(index: number): object { return {'background-image': 'url(' + this.events[index].images[0].url + ')'}; } 回答1: When you see: Cannot read property

Conditional background image in header

▼魔方 西西 提交于 2019-12-11 09:29:54
问题 I'm trying to modify the content-header of a website, so it will display a custom background image for the search result page and for single posts of a post type. Here's the current working code: <div class="single__header" <?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. echo 'style="background-image: url(\''; the_post_thumbnail_url('post-background'); echo '\'); background-repeat: no-repeat; background-position: center center; -webkit-background

CSS background image not working

空扰寡人 提交于 2019-12-11 09:01:56
问题 I have a modal demo here (fiddle)... When it comes up, the background image for the modal window shows up. However, in this code below, you'll see I have a background image for the close window function. It's not showing up and I don't understand why. The CSS should have it showing in the top, right-hand corner. .reveal-modal .close-reveal-modal { background: #eee url(http://webfro.gs/south/kb2/images/broken_link.png) no-repeat; position: absolute; top: 50px; right: 100px; text-shadow: 0 -1px

JFrame Back Ground Image that other buttons don't appear on frame when background image is set? [duplicate]

谁说我不能喝 提交于 2019-12-11 08:28:40
问题 This question already has answers here : Setting background images in JFrame (4 answers) Closed 4 years ago . I want to add a background image to my frame.But when i add an image to my frame it was added successfully but other things like j label and buttons added on frame afterwords don't appear on frame. i have kept image on Desktop. below is my code package UI; import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.Color; import java.io.File; import javax.imageio.ImageIO

How to put a bullet beside the heading elements as background image

久未见 提交于 2019-12-11 08:15:22
问题 I'm using CSS and attempting to get what looks like a bullet point in the headings: This is the exact image I want. What I've done : h1,h2,h3 { background-image: url("the image link goes here"); } anyone get any ideas I've tried moving it and stuff but it just isn't happening. Cheers. 回答1: You should set the background-position as well and also a left padding for the heading elements to push the text to the right: h1, h2, h3 { background: url("the image link goes here") 0 center no-repeat;

Background images do not render on Ruby on Rails application

白昼怎懂夜的黑 提交于 2019-12-11 08:09:09
问题 I am attempting to have a image render in the background of a div with the class head . My application view is written Haml and the body is defined as follows: %body .container .head .sixteen_columns .top-nav Included in my application stylesheet is: .head { background-image: url(/images/background_image.jpg); width: 100%; height: auto; } I have tried a number of variations to specify the path of the image and altered the image name several times but to no avail. What is the issue? 回答1:

Changing background-image onscroll

懵懂的女人 提交于 2019-12-11 08:01:24
问题 I'm trying to change the background image of an element after a certain position has been scrolled past. Here's a snippet of my code: <body> <script> window.onscroll = function() {scrollBG()}; function scrollBG() { if (document.body.scrollTop > document.getElementById("one").getBoundingClientRect().top || document.documentElement.scrollTop > document.getElementById("one").getBoundingClientRect().top) { document.getElementById("outer").style.backgroundImage = "url('imgs/pic1.jng')"; } else {

Stretch a background image (SVG) to 100% width and 100% height?

泄露秘密 提交于 2019-12-11 07:56:24
问题 The behaviour I want to achieve is the width of background-size:cover; , but the height of background-size:contain; by stretching the image. I thought that background-size:100%; should do this, but look at the example - it does not. .container { background-image:url("https://upload.wikimedia.org/wikipedia/commons/3/34/Red_star.svg"); background-position:center center; background-repeat:no-repeat; width:300px; height:180px; background-color:#eef; border-bottom:1px solid #000; } #container1 {

Is it possible in CSS3 to have multiple background images with specific size for each of them?

南笙酒味 提交于 2019-12-11 07:49:25
问题 I have DIV which has 2 backgrounds, in my case, it is gradient and image. I want to change the size of the background image, but not the size of the gradient ? Is it possible ? Please note: I don't want to use 2 DIVs, one for gradient and one for background image EDIT: <div id="button"></div> #button { background: url(img.png) no-repeat 0.5em 0.5em, -webkit-gradient(linear, left top, left bottom, from(#74ae0f), to(#497105)); } 回答1: Ok, by just simple coincidence I have found answer to my

How can I draw a fullscreen background image in WebGL like sketchfab?

泪湿孤枕 提交于 2019-12-11 07:29:01
问题 I know how to draw models, but I don't know how to draw a fullscreen background image. I think I should draw it at the zfar of the camera. But I have no idea how to calculate its size... In sketchfab, it seems the background image can implement the css property background-size: cover . And I notice sketchfab do not implement it by css. I really want to know how to implement this! 回答1: How can I draw a fullscreen background image in WebGL like like style background-size: cover ? Create a