Utilizing CSS positioning for layered backgrounds

I'm looking to create a unique background design using three different images. The main background should consist of a 150px x 150px image repeated throughout, with the top line featuring a second image repeating only on the x-axis and the bottom line displaying a third image repeating also on the x-axis. Can anyone guide me on how to achieve this effect? Thank you in advance!

Answer №1

Give this a try!

body {
    background: url(topbackground.png) repeat-x, 
               url(bottombackground.png) bottom fixed repeat-x,
               url(centerbackground.png);
}

Additionally, check out this link to see an example with numerous images of cute kittens!

http://jsfiddle.net/7Rt99/

Answer №2

To achieve the desired effect, it is recommended to create three separate divs with each background repeated in its own section.

<div class="two" id="one">
</div>
<div class="two" id="one">
</div>
<div class="two" id="one">
</div>

#one{
background-image:url('http://www.shrtclothing.com/images/share/facebookthumb.jpeg');
    background-image:repeat;
width:1000px;
height:150px;
}

http://jsfiddle.net/hVvdL/

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

Upon clicking the navbar dropdown item, it shifts its position

I am currently working on setting up a navigation bar with multiple items aligned to the right side. However, I have encountered an issue where clicking on the "notification" icon causes the other icons in the navbar to move instead of remaining fixed in p ...

What is the best way to dim and display a loading GIF in the middle of a table?

Is it possible to apply a transparent grey effect to an entire <table> and display a loading image in the center? I am interested in running some AJAX calls where the table is rendered inaccessible, with a grey overlay and a loading GIF positioned a ...

Is there a way to activate sorting icons in bootstrap datatables?

My attempt to replicate the datatable from this template is not working as expected. I can't seem to get the up and down icons for sorting to show up. I've followed all the instructions but they are still missing... $(function () { $(&a ...

How can the $spacer variable in Bootstrap be modified?

My attempt to adjust the $spacer variable in SASS to increase margins seems to be failing. Here is my code: @import url(../node_modules/bootstrap/scss/_functions.scss); @import url(../node_modules/bootstrap/scss/_variables.scss); @import url(../node_module ...

Updating CSS using jQuery

Before I continue: While I am familiar with the jQuery.css() function, it unfortunately does not work in my particular case. Allow me to elaborate. Currently, I have a jQuery color picker set up to change the highlighting on a website. My goal is to utili ...

Switch the hover effect to be activated by clicking

Recently, I discovered an incredible plugin created by the talented developer janko. It has been a fantastic addition to my project. The only issue I've encountered is that I do not want the default hover style. Is there a way to transform it into a ...

Suggestions for creating a simple implementation of a 3 x 3 cell layout with a large center using flexbox are

Creating a grid layout like this 3 x 3 cell with large center using CSS Grid is quite straightforward. .container { display: grid; grid-template-columns: 60px 1fr 60px; grid-template-rows: 60px 1fr 60px; } But what if we wanted to achieve the same ...

After the animation has finished, the ".animated" class should be removed. If the element is reloaded, the class should be added back using plain

Within my CSS, there is a ".animated" class that is automatically applied to all elements with the "drawer-wrapper" class. The HTML structure looks like this: <div class="drawer-wrapper animated"> foo </div> I created a function that ...

Nested table border collapse is not functioning as intended

Upon inspection, it appears that border-collapse is not functioning as expected: UPDATE: In this case, when referring to border-collapse not working, I am highlighting the issue where the inner table displays a double border, resulting in an unappealing a ...

When swiping right with Swiper.js, the slides are jumping by all, skipping the following slide, but the left swipe functions correctly

Here is the code I used for my swiper element: new Swiper("#swiper-pricing", { slidesPerView: 1.3, spaceBetween: 30, centeredSlides: true, loop: true, keyboard: { enabled: true, }, autoplay: { delay: 50 ...

What is the best way to center an HTML element between two other elements?

Kindly, take a look at this straightforward jsFiddle: http://jsfiddle.net/mark69_fnd/vtLrt/10/ HTML: <div class="char"> <div> <div class="char">A1</div> <div class="char anchorToMiddle">D1</div> <div c ...

When CSS animations are used on numerous elements, it can lead to variations in the speed of

I made an animation to move elements from the top to the bottom of a page. I have 4 objects with this animation applied, but for some reason, they are moving at different speeds. It's confusing me. What could be causing this inconsistency? body { ...

How to make a HTML div background fill the entire page

Is there a way to extend the background in a div so that it adjusts to fit the screen resolution? I also want to include a navigation bar at the top right corner of this div for the intro page. There will be additional content in other divs positioned be ...

Ensure that text within openhtmltopdf is aligned to the right and any unnecessary white space at the

Currently, I am using the open source project openhtmltopdf but I have encountered a certain issue. Within a div-element, I have a p-tag with text-align: right styling. The text is aligned correctly to the right until there is a line break due to the widt ...

WebView on Android still showing highlighted text even after selection has been cleared

When using my web app on an android WebView, I've noticed that whenever I click on something or navigate somewhere, a blue highlight appears on the container div. It sometimes disappears quickly, but other times it remains until clicking elsewhere. I ...

Ways to differentiate between a thumbnail image and a detailed image

On my image-heavy gallery page, I am looking to utilize a thumbnail image that is pre-sized with a maximum width of 200px. The images themselves are quite large, often surpassing 2000 pixels on the longest side. Although I have been using the Bootstrap cl ...

The navigation bar initially fills the width of the screen, but does not adjust to match the width of the table when scrolling

I've spent the last 2 hours playing around with CSS, using width:100% and width:100vw, but nothing seems to be working. Currently, the navigation bar fits perfectly across the screen on desktop browsers, so there doesn't seem to be an issue ther ...

`Text-overflow ellipsis should function consistently across both Firefox and Chrome browsers`

A design has been created to showcase captions for articles and their respective statuses. The article name box has a fixed width, with text-overflow:ellipsis applied to trim excessively long names. Additionally, a light grey dotted line is added at the en ...

The font-face declaration is not functioning properly within the CSS code, causing the browser to fail in displaying the

@font-face { font-family: BYekan; font-style: normal; font-weight: normal; src: url(../resources/BYekan.eot); /* IE9 Compat Modes */ src: url(../resources/BYekan.woff) format('woff'), url(../resources/BYekan.woff2) ...

Creating a search form in Bootstrap 4 that is centered and expands to full width only on small screens

I'm currently working with a bootstrap v.4 navbar that has 3 elements in it. I've managed to align the elements evenly so that the search bar is centered in the navbar. However, when it collapses it takes up the full width of the screen. Here is ...