How to repeat multiple images over one element using CSS
Tags: css
Problem :
How do I use CSS to repeat a first background image both vertically and horizontally, and repeat a second background image just horizontally? I wish it not to be dependent upon CSS3.
I tried the following, but no success.
body {
font-family:Verdana, Geneva, sans-serif;
position:relative;
z-index:1;
}
body:before,
body:after {
position:absolute;
z-index:-1;
top:0;
left:0;
right:0;
bottom:0;
}
body:after {
background-image:url('../images/bg.png');
background-repeat:repeat;
}
body:before {
background-image:url('../images/top-bg.png');
background-repeat:repeat-x;
}
Solution :
Have a look at CSS3 multiple backgrounds. Supported since Firefox 3.6, Safari 1.3, Chrome 10, Opera 10.50 and Internet Explorer 9.0.
If you must support IE8 or earlier (noting that Google drop support for IE8 from next month), either combine the images into 1, or overlay multiple elements.
<!doctype html>
<html>
<head>
<style type="text/css">
#tile, #logo {
padding:0;
margin:0;
border:0;
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
}
#tile{
background-image:url('http://upload.wikimedia.org/wikipedia/commons/e/e7/Procedural_Texture.jpg');
background-repeat:repeat;
}
#logo{
background-image:url('http://upload.wikimedia.org/wikipedia/en/9/95/Stack_Overflow_website_logo.png');
background-repeat:repeat-x;
}
</style>
</head>
<body>
<div id="tile"></div>
<div id="logo"></div>
</body>
</html>
This may be one of various solutions available.
CSS Howto..
I'm guessing that the offending space characters in your source code are not SPACE (U+0020), but are actually NO-BREAK SPACE (U+00A0). Visually, they appear identical, but if you view your...
The code snippet you are looking for is on the man page: http://codex.wordpress.org/Function_Reference/get_children#Show_the_first_image_associated_with_the_post_and_re-key_the_array What this does is puts all of the post IDs into an array called rekeyed_array Then you...
Found the fix... As I said, trying to force the container to refresh its content using some different css properties didn't work. What worked though was to add a span...
I think that you can't do it with css. However you can use jQuery to do it. Quite easy: HTML (add classes to li elements to identify them in your...
Please be specific when you say "format". hope this helps you How to format text in options for select in AngularJS? ...
You're looking for min-width. div{ width:50%; /* Your dynamic width */ min-width:300px; /* The narrowest the element can be */ } http://jsfiddle.net/ejbSd/...
Set the width to 48% for the blocks and min-height will give it equal area in vertical direction. If you need to limit the spacing between the columns, set a...
Something like this? Demo CSS u:before { content: attr(n) ') ' attr(start) ' - ' attr(end); color: #999900; padding-right: 30px; font-size: 9pt; } You can have multiple attr() inside. Just...
The navbar-fixed-bottom uses position:fixed so it's removed from the flow of the page and no longer takes the width of it's container. You could instead make another class (ie; navbar-bottom)...
Take a look at this fiddle. Here's the code: HTML: <div class="icon"> <div class="shine"></div> </div> And CSS: .icon { width: 150px; height: 150px; border-radius: 30px; background: red; float: left; margin:...
Try something like this. Not exactly the content you posted. But this works with large content in one of the boxes as well. Edit : Dynamically added content works as...
A CDN would definitely help. And with 140 pictures, I hope it contains more than just server. Just link directly to the IP of the servers, to avoid unnecessary...
Just add position: relative for the image. <a class="brand" href="#"> <img src="http://68.50.243.1/wunhopkuendo/img/logo.png" style="z-index: 99; position: relative;" /> </a> The reason behind this is, the z-index works only on positioned elements,...
Why not try something like http://disqus.com/ It requires no programming on your end at all and allows users to share there thoughts on your content....
To be completely honest I have no idea why there is a gap there. There shouldn't be. But I did take your code and edited it and came up with...
This should fit your slowly moving+infinite flowing+responsively fit to height background criteria. html, body { height: 100%; margin: 0; padding: 0; } #animatedBackground { width: 100%; height: 100%; position: absolute;...
It doesn't. That tutorial is simply for styling, not for generating the breadcrumbs; you have to do that part yourself, through some sort of scripting or manually. Re: Update Breadcrumbs...
.bg-cover span{ z-index: 10; color: #333; } .fishing:hover .bg-cover span{ color: white; } and remove the inline color for the fishing text jsfiddle http://jsfiddle.net/Drea/vsnxbw0q/...
(Disclaimer: I have worked on Microsoft Edge) This is not a supported scenario at present: https://msdn.microsoft.com/en-us/library/mt227929%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 Microsoft Edge does not support user stylesheets. An extensibility system is coming for Microsoft...
Im not sure if you want JS, i decided to answer your question if you want CSS3, try this: HTML: <img src="image.jpg" data-src-960px="image-960px.jpg" data-src-1260px="image-1260px.jpg" alt=""> CSS: @media (min-device-width:320px) { img[data-src-960px]...
Ok so here is the gist of it. While testing I removed the second nested ul li and changed it to a simple div element with class absolute: .absolute{ position:...
Yes, you can with the :before pseudo-element and CSS counters: body { counter-reset: section; /* Set the section counter to 0 */ } section.question::before { counter-increment: section; /* Increment the...
height: 100% as a percentage only affects the height of the element if that element's parent has an explicit height. The height of the body tag by default is the...
Your html and css work so there must be a typo somewhere in your css file that causes it to be not used . Everything is working as it should....
You can indeed use the pseudo-elements :after and :before to first mirror the image using transform: scaleY(-1); and second overlay the mirrored image with a linear gradient going from a...
NO Way to do it on CSS only. And Hover is not apply for DIV. Its for A, UL > LI... You must know about Javascript or jQuery. Mouse hover...
You can't select JSON with CSS. It operates on a DOM. It looks like you aren't trying to though. You just have a text node (which you created using half...
One possible way is something like this (.hMenu is the outer ul here): .hMenu > li { /* for direct childs (>) of .hMenu that are li-s */ /* inline-block...
Ok, I found a much better solution using html5 and draggable: <html> <head> <script type="text/javascript"> function update_size(ev) { ev.preventDefault(); var top_div = document.getElementById('top'); var bottom_div = document.getElementById('bottom'); var left_height =...
.bw { -webkit-filter: grayscale(100%); -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; -ms-transition: all 1s ease; transition: all 1s ease; } .bw:hover { -webkit-filter: grayscale(0%); }...