The background image is overly magnified

I've been having an issue with the background image on my div looking too zoomed in and losing its clarity. Below is the HTML and styling that I have attempted:

<div class="grid-x intro">
        <div class="cell large-12 medium-12 small-12 one">
        </div>
      </div>
        <!-- end of intro -->
styling

.intro{

background-image: url("../images/house4.jpg");
background-size: cover;
background-repeat: no-repeat;
width: 100%;
/* height: auto; */
padding-top: 66.64%;
}

Answer №1

Everything seems to be fine here ... try using "background-size: 100% auto;" The reason for this is that your image is wider than it is tall, and you've used background-size: cover;. This setting zooms in on the background image and crops the rest of the width. Your code is correct, just make sure to use a resized image like 500px*333.2px (or around this ratio) to fit within a 66.64% padding

.intro{

background-image: url("https://image.freepik.com/free-vector/geometric-models-gradient-background_23-2148326516.jpg");
background-size: 100% auto;
background-repeat: no-repeat;
width: 100%;
/* height: auto; */
padding-top: 66.64%;
}
<div class="grid-x intro">
        <div class="cell large-12 medium-12 small-12 one">
        </div>
      </div>
        <!-- end of intro -->

Answer №2

Perhaps the resolution of the image isn't optimal. Alternatively, if you prefer a partially covered background, you could reduce the size of the background image using the following CSS:

background-size: 50%;

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

What is the best way to apply multiple text shadows to a single piece of text using the jQuery ".css()" method?

Is it possible to create multiple text shadows for a single piece of text using the jQuery ".css()" method? I'm currently working on animating the title of a page on my website, which includes adding a 3D effect with multiple shadows. I also want to ...

Insert the URL into either a div or an iframe

It seems like a common issue. I've come across multiple solutions for this problem. using jquery load using iframe I attempted both methods but encountered difficulties in loading content. Specifically, I tried to load google.com and it didn't ...

Applying different styling to the same class within a different element using the + selector

Have you ever come across a website with code similar to what I've shared on this jsfiddle: https://jsfiddle.net/roa8k7js/ This particular site boasts an elaborate CSS styling sheet, exceeding 10,000 lines in length. When transitioning this website t ...

Is it possible for me to input text into html while the page is loading?

Is there a way to preload external files while a web page is loading? I'm looking to incorporate a JavaScript templating engine into my website and prefer to store my templates in separate files. Instead of loading these templates asynchronously, I&ap ...

Place one div element with a float property set to AUTO, followed by another div element that expands to

I am trying to place two divs inside another. The inner divs are floated, with one having a "width: auto;" and the other needing to fill the remaining space. I have searched for examples, but they all involve at least one fixed width element, which is not ...

Using ng-include destroys the styling of the dropdown menu in a bootstrap ul li format

Greetings! I am attempting to replicate the following code snippet that creates a basic dropdown menu using bootstrap: <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="fal ...

Navigating through dropdown browser menus using VBA

I am looking to automate the process of looping through a dropdown list on a specific website and downloading the latest file for each entry. I have successfully opened the website and clicked the "submit" button, but I am struggling to find a solution to ...

Show an item that is positioned absolutely ABOVE its container with overflow: hidden enabled

Currently, I am facing a challenge with my carousel that contains thumbnails. Whenever a thumbnail is clicked, a larger preview should appear centered above the clicked item. The issue arises because the container div of the carousel has overflow: hidden; ...

Sliding in the wrong direction on Bootstrap 5.2 carousel

I'm currently working on a carousel project. However, I encountered an issue where the images slide down initially and then jump up to the correct level as depicted in the image below. I've tried adjusting the height, width, and auto settings to ...

Simple method to retrieve unordered list identifiers as an array using PHP

Currently, I am working with an unordered list where I am using DB ids as the list-item ids. When the Submit button is pressed, I want to present all the ID's of my list items as an Array in PHP. I am still learning JavaScript and although there are s ...

What is the best way to center the image on a page?

How can I center an image on the screen with a caption? <div id="team-area"> <div class="container"> <div class="row"> <div class="col-12"> <h3 class="main-title">Our Team</h3> < ...

Utilizing Material UI tabs panel with customized CSS styling

Having trouble changing colors and CSS in the TAB PANEL using material-ui. Any tips or suggestions? :( It seems like useStyle and theme functions are not working as expected. I was able to modify other properties like scrollable, but colors seem to be fix ...

Ways to showcase numerous products within a single category label

views.py : def get_meals(request): template = loader.get_template('café/meals.html') meal_data = MealInfo.objects.all() category_data = MealsCategory.objects.all() context = { 'meals': meal_data, ' ...

Is there a way to make those three elements line up in a row side by side?

I'm working on a layout using HTML and CSS that will display two images on the left and right sides of the browser window, with text in between them. I want them all to be horizontally aligned within a container. Here is the code snippet: <div cla ...

Ensure that the bottom border of the navigation bar is in line with the

How can I achieve a bottom separator for the navbar that seamlessly aligns with the rest of the page design, similar to the approach taken by Refactoring UI as shown here? Currently, when I add a border to the container inside the navbar, it extends beyon ...

Exploring Instagram post layouts: A comparison of card-columns in Chrome versus other web browsers

Utilizing Bootstrap 4 card-columns for showcasing Instagram posts on a website has showcased some discrepancies across different browsers. Notably, Chrome seems to be losing the second column as compared to other browsers. Screenshots highlighting these di ...

Updating the appearance of a non-declared HTML child component on-the-fly using Angular

Trying to dynamically adjust the style of an unspecified div is causing some trouble. Using Angular and PrimeNG, invisible divs are being generated that I cannot access through inline styles. The objective is to allow a user to input a width as a string (5 ...

What is causing my mobile version not to resize and adjust to fit the screen properly?

Currently utilizing Bootstrap 4 along with the viewport meta tag, %meta{:content => "width=device-width, initial-scale=1, shrink-to-fit=no", :name => "viewport"}/ Even after hiding all images with .hidden-xs-up, the display on Chrome mobile appear ...

Steps to troubleshoot the TypeError: cv.Mat is not a constructor in opencv.js issue

Encountering a problem while trying to use opencv.js for detecting aruco markers from my camera. Each time I attempt to utilize the method let image = new cv.imread('img'); An error keeps popping up: TypeError: cv.Mat is not a constructor ...

How to keep the Bootstrap column in place while making it fixed

I'm struggling to make the second column (yellow part) stay fixed in position. I've tried using CSS position:fixed, but the column keeps shifting to the left. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/cs ...