error in css styling detected

Why was the CSS style "background-position: center;" missed? It was because the background will override the background-position property.

<html>

<head>
  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f7818292b7c5d9c2d9c6c1">[email protected]</a>/dist/vue.js"></script>
</head>

<body>
  <div id="div1" :style="'background-position: center; height:200px;width:300px;background: url('+imgURL +')'"></div>
</body>
<script>
  var vm = new Vue({
    el: "#div1",
    data: {
      imgURL: 'https://www.baidu.com/img/bd_logo1.png'
    }
  });
</script>

</html>

Answer №1

It appears that in your CSS, you are substituting the background-position with background further down in the rules. To fix this, you can replace background with background-image.

<html>

<head>
  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e5939080a5d7cbd0cbd4d3">[email protected]</a>/dist/vue.js"></script>
</head>

<body>
  <div id="div1" :style="'background-position: center; height:200px;width:300px;background-image: url('+imgURL +')'"></div>
</body>
<script>
  var vm = new Vue({
    el: "#div1",
    data: {
      imgURL: 'https://www.baidu.com/img/bd_logo1.png'
    }
  });
</script>

</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

prettyPhoto popup exceeds maximum width and height limitations

I am currently using the most up-to-date version from No Margin for Errors and I have set allow_resize to true. However, the size of the display is still too large. Is there a way to set a maximum width/height? I have already configured the viewport as fo ...

Tips for effectively utilizing axios without Vue.js CLI (for instance, in JS Fiddle)

Currently, I am immersing myself in the world of vue.js. To get a better understanding of the dependencies, I have chosen not to utilize the Vue cli just yet, opting for JS Fiddle instead. My next goal is to interact with an API using axios. Here is a glim ...

Even when applying a class, the CSS link:hover style will only affect the initial occurrence

I've hit a wall on this issue and can't seem to find a solution. I styled a few links using classes, but it seems that only the first link is accepting the :hover and :visited state styling. I made sure to use classes to style all of them. Not su ...

Providing Node-server with Vue.js Server Side Rendering

I've been attempting to deploy the Hackernews 2.0 demo on my Digital Ocean droplet but have hit a roadblock. npm run start starts the server on port :8080. npm run build is used for production builds. The specific build tasks can be found below: ...

Entering in full screen mode

Is there a way to create a first screen appearance that spans the entire screen? I want the whole page to be fullscreen and when someone scrolls down, it transitions to a new screen. I am struggling to find a solution for this. body { margin: 0 0 0 0; ...

Issue with Thickbox - showing up towards the end of the page

I'm encountering a strange issue with a PHP page in Wordpress. When I include an inline Thickbox on the page and try to open it, the Thickbox appears at the very bottom of the page, below the footer. Interestingly, I copied the generated HTML code an ...

Attempting to repair navigation menu on grou.ps website

Hey there, I'm currently working on improving the appearance of my website. The original site can be found at . After integrating it with the grou.ps community platform, I noticed that the navigation menu is not displaying correctly and the image is ...

Attempting to bind an input parameter using NgStyle in Angular version 2 and above

Issue: I am in need of a single component (spacer) with a width of 100% and a customizable height that can be specified wherever it is used in the HTML (specifically in home.html for testing): number 1 <spacer height="'200px'"></spa ...

Tips for creating an expandable div with floated content

I am looking to create a flexible div that expands based on its content. Inside this div, there are two floated left divs with fixed widths. These inner divs should also expand according to their text content. To clear the floats, there is another div wi ...

The functionality of the mapGetters function varies from that of store.getters

Looking below, you'll notice I have a getter that returns a new method which requires a parameter. Based on the documentation, I should be able to invoke this method without the need for two separate method calls. When directly using store.getters, ev ...

Resource is used to return an array as an object

There is something peculiar going on. I have come across an array structured like this: => [ "optionalinformation" => [ "domain" => [ "type" => "string", ], ], ] This particular array is utilized by a reso ...

What is preventing my image from moving upwards?

I've been struggling to move this image up, despite trying several methods. I really want it to be aligned horizontally with the PV picture. I need the HP image to be moved directly upwards so that it aligns horizontally with the PV image. This is t ...

Discover the process for simulating a browser zoom using JavaScript

Is there a way to control the browser's zoom level using JavaScript? I decided to create my own solution to override the default browser zoom behavior. The current code works fine if starting from a scale of 1, but I'm facing an issue when alrea ...

Deactivate the save button in case of errors occurring with Laravel and Vuetify

Currently, I am utilizing the Vuetify v-text-field within a form. I have implemented some basic validation rules (such as requiring the field to be filled) which can be checked using simple rules like (:rules="[ rules.required ]"). However, in ad ...

Issue: The system does not recognize 'cleancss' as an internal or external command

After successfully installing clean-css via npm command line, I was eager to start using it to concatenate and minify some css files. However, my excitement quickly turned to frustration when I encountered this error: 'cleancss' is not recognize ...

Safari browser not supporting CSS @property --rotate functionality

This card's animation is functioning well in Chrome, but it is not compatible with Safari and Mozilla Firefox. I suspect the issue lies with the @property --rotate, as it is no longer supported by Safari. Therefore, I am searching for an alternative ...

Is it possible to utilize Vue's v-for function without the need for ul or ol elements?

Hey there, I'm just starting out with Vue and I'm looking to display some data in rows without using numbers or bullet points. Is there a different way to achieve this without the current approach I have below? <li v-for="product in contract. ...

JQuery integration resulting in disappearance of Input-group-btn element

Allow me to explain my current project. I am in the process of developing a Modal that enables users to input a password There will be an option to toggle between showing or hiding the text in the password field using a button positioned on the right sid ...

Influence of scoped styles on external webpages

I'm facing an issue with my nuxt app where I have two pages, each with different background styles. However, the background of one page is overriding the other. index.vue <style scoped> body { background-color: #ffffff; } #banner { backgr ...

Utilize Yandex Translate API in VueJS to asynchronously detect languages

Recently, I've been tinkering with the Yandex Translate API in conjunction with VueJS to determine the language of input text asynchronously. So far, everything is functioning correctly. However, there's a unique issue that arises - the console ...