Unable to set CSS image as background

Currently, I am in the process of developing a website using HTML 5, CSS, and JavaScript. However, I am encountering an issue with image manipulation on the site. I am attempting to make the image the background but every method I try seems to be lacking a div or overlay.

HTML

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
   <link rel="stylesheet" type="text/css" href="attributes.css">
</head>
<body>
<!-- page bar header navigation tabs -->
<div class="head_bg">
  <div class="wrap">
    <div class="logo">
        <a href="index.html">
            <img src="file:///C:/Develop/CodeSamples/manage-landing-page-master/images/logo.svg"> 
             </img>
            <div class="banner" id="move-top">
                <img id="circular_clip" src="file:///C:/Develop/CodeSamples/manage-landing-page-master/images/bg-tablet-pattern.svg"></img>
            </div>
        </a>
    </div>
   </div>
</div>

CSS

div.banner {
   width: 780px;
   margin-top: 0px;
   margin-left: 800px;
} 
.head_bg {
    margin-top: 25px;   
}
#circular_clip {
  position: absolute;
  clip: rect(0, 100px, 200px, 0);
}
.banner {
   background-position: -20px 0px;
   /* clip:rect(500px,50px,500px,0px); */
} 
.menu-left {
    text-align: right;
}

.logo {
    margin-top: 15px;
    padding: 4px 4px 4px 4px;
}
.menu_head_banner a {
   active: true;
}

.wrap {
   margin: 0px auto;
 }

.header_row_tabs a li ul {
  margin-top: 15px;
  float: center;
  font-size: medium;
  font-family: 'Lato', sans-serif;
  padding: 33px 15px;
  display: block;
  text-align:center;
  align-items: right;   
}

.header_top_background li {
   font-size: large;
   padding: 0.45em 1em 0.55em 1em;
   background: #EB6841;
   float: right;
   border-bottom: 5px solid #BA3A14;
   border-right: 5px solid #CD542F; 
 }

I would like to set the bg-tablet-pattern.svg as the background using .banner{ background-image:url();} along with background:url() and apply styling in the HTML document, hoping that by incorporating these features in the CSS, the intended image will appear in the background. While I can see the image correctly, my objective is to have it span across the page from right to left, covering the corner of the page. This explains the reason for the positioning, although the image does not start at the top of the page as desired. Despite being able to implement the background-image feature through CSS, when trying to relocate elements within different parts of the page, the image does not remain stationary. Is there a way to lock the background image in place?

Update

I have managed to position the image, yet there are still some responsive elements that need addressing. Similar queries have been raised on StackOverflow regarding code compatibility, and while this particular issue has been resolved, remaining concerns exist regarding the responsiveness of the design. CSS Image positioning

Answer №1

Great! I have a helpful solution.

To enhance your website design, you can include the following code snippet in your CSS file. By applying this code, every element with the body tag will display the specified image as the background. Make sure to enclose all of your website content within body tags for optimal coverage.

body {
  background-image: url("Image.jpg");
}

Below is an example HTML code snippet for your reference:

<!DOCTYPE html>
<html lang="en">
<body>
  <p>This is a Test
    <div>You should see a Background Image</div>
  </p>
</body>
</html>

Please let me know if this solution works for you and feel free to ask if you need further assistance.

For additional information, you can visit this link: https://www.w3schools.com/css/css_background_image.asp

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

Is it possible to customize the formatting of the information displayed within a details tag when it is nested under a summary

Is there a way to format the details information so that it aligns underneath the summary tag? Currently, both lines of text are aligned to the left. <details> <summary> Summary 1 </summary> Details 1 </details> ...

The issue persists with the JavaScript window.location script constantly refreshing

I am currently working on a small web application where I want to update 2 parameters in the URL using Javascript. However, every time I use "window.location.search = 'scene.html?name=' + person + '&scene=' + readCookie("scene");", ...

Divide the PHP code into separate files

Can someone help me with a coding dilemma I have? I couldn't find any information on Google or this site about it. A friend of mine who has experience in website development and runs his own business uses an interesting system that is new to me. He ...

Tips for disabling viewport resizer while accessing the Console panel in Chrome using Control+Shift+J

Currently, I am utilizing the viewport resizer in Chrome to preview how my code appears on various devices. However, I have encountered an issue - whenever I try to access the console using ctrl + shift + j, the viewport resizer opens instead. You can obs ...

Utilizing a jQuery plugin for input file validation

This code is functioning properly, however the file field is not being validated. All input fields are successfully validated by this plugin except for the file type field. I believe there may be something missing in my implementation, so please help me de ...

How can one determine the most accurate box-shadow values?

I am trying to extract the precise box-shadow parameters from a CSS style rule generated by the server. My main focus is determining whether the element actually displays a visible shadow or not. There are instances where the shadow rule is set as somethi ...

Using jQuery for validation using a checkbox

I'm currently working on a registration system that allows users to choose between paying immediately with a credit card or later with a check. Depending on their choice, the fields for credit card information should either be validated or hidden to d ...

The slider spills over the edges of the page

Seeking assistance – I managed to insert this logo slider onto my page. It seems to be functioning properly, but due to the width settings of the website engine, the modules are not fully stretching across the page. In an attempt to make the slider cove ...

Having trouble aligning material-ui GridList in the center

I am currently working with a GridList in order to display Cards. The styling for these components is set up as shown below: card.js const useStyles = makeStyles({ card: { maxWidth: 240, margin: 10 }, media: { heigh ...

Tips for optimizing Angular source code to render HTML for better SEO performance

Our web platform utilizes Angular JS for the front-end and node js for the backend, creating dynamic pages. When inspecting the code by viewing the source, it appears like this: For our business to succeed, our website needs to be SEO-friendly in order to ...

The design breaks occur exclusively in the Android default browser

I am experiencing issues with the design of a nested div element when viewed in the default Android browser. Unfortunately, I don't have access to tools that would allow me to identify the cause of this problem. However, the design functions correctly ...

Styling the background of a container in CSS using Bootstrap

Currently, I am utilizing bootstrap and trying to find an elegant solution for adding a background to my container. Specifically, I am working with the bootstrap class container, as opposed to container-fluid. The official Bootstrap documentation advises ...

Ways to incorporate design elements for transitioning focus between different elements

When focusing on an element, I am using spatialNavigation with the following code: in index.html <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfb5acf2acafbeabb6beb3f2b1bea9b6 ...

Is there a way to extract JSON information from the source code of an HTML page?

I'm currently in the process of extracting data from an online music database. Specifically, I am interested in retrieving information that can be identified using CTRL+F -- "isrc":"GB-FFM-19-0853." view-source: Utilizing Python and Selenium, I have ...

Embedding images within written content

Is there a way to insert an image into text from a specific position without using tables? I'm looking for a method other than aligning the image "left or right". ...

Struggling to link an external JavaScript file to your HTML document?

While attempting to run a firebase app locally, I encountered an error in the chrome console: GET http://localhost:5000/behaviors/signup.js net::ERR_ABORTED 404 (Not Found) Do I need to set firebase.json source and destination under rewrites or add a rout ...

Tips for creating incremental progress on a pop-up page?

I am looking for guidance on creating a page with specific functionalities. Here is what I have in mind: I want to implement a button that opens a popup when clicked. The popup should display static instructions and buttons for the user to progress throu ...

basic two-column design

Located at the end of this page, you will find two distinct columns. On the right side, there is a Twitter feed, while the left side showcases a YouTube video and a comments section. Below is the HTML and CSS code that was used to create these columns: .l ...

Redirecting files from the file system to the emulator is not functioning properly

I am new to Phonegap and need help resolving this issue. In my application, I need to redirect to the List.html file when a button is clicked. Here is the code I have written: button1 function test() { window.location="/home/swift-03/phonegapexa ...

Create two grid components for Material-UI and use Flexbox to ensure that both items have equal height

I'm currently working on ensuring that two grid items have the same height using flex in Material UI, but I've hit a roadblock. It seems like my approach with the Grid element might be incorrect. I've experimented with adjusting the height a ...