Parallax effect for multiple backgrounds only using CSS - html

I'm trying to achieve parallax effect only using CSS. I have achieved to manage parallax effect for a single image by having it's position fixed and setting z-index to -1. I'm having trouble incorporating the same technique for the second image as it overlaps with the first one. How do I resolve this?

Related

Fixed Background Image Change After Scrolling To A Section

I'm a front end intern and was asked to try and replicate a website mockup video which shows sliding content with a fixed background, but after reaching a certain section tag, the fixed background would switch to a different background. I'm using tailwind CSS to try and emulate the effect. Below is my way to emulating something which I think is similar:
<section class="bg-bg0 md:bg-bgB bg-fixed bg-no-repeat bg-center">
I achieve the effect by giving the sections tailwind css the aforementioned classes. When it reaches to the section I want to change backgrounds, the background is changed by switching the background class from bg-bgA to bg-bgB, and the effect is achieved, however on transition, the page lags TERRIBLY. Is there a more efficient way to go about achieving this effect? I want to apologize in advance if my solution is a dumpster fire, or if the way I ask is wrong.
Found out the issue, the background images were too large, decreasing them by 75% of their original size did the trick.

Show background image through overlapping divs in HTML & CSS

Could anyone tell me if the scenario below would be achievable with HTML and CSS? My goal is to show the background-image of my HTML body through a clipped div.
Please bear in mind that the final website would be responsive (mobile-first), so the solution should allow the different positioning of the body background images upon resizing.
Basically: is there anyway to show a div as a cutout of the underlying div?
I thought about providing separate background images for each circle to show the illusion that the circles show the body background, but as the design is responsive, alignment issues would quickly occur.
Any insights? Please let me know if more data is necessary. Thanks in advance.
I think this is similar:
http://ask.webatall.com/html5/7619_transparent-half-circle-cut-out-of-a-div.html
and should help? Instead of the shape you'd have to use circles, but the principle should be the same.
Also, if it doesn't work a combination of 2 elements with half circles cut out could achieve the effect.
This answer does a similar thing with another shape:
http://www.samhohce.net/questions/30259780/onhover-button-cut-out-a-triangle-and-show-background

How to design HTML content like fixed backgrounds with scrolling effects?

This is an example of the effect I'm trying to acheive only without using images.
I want to create these screens that take up the entire screen like in the example. But instead of using background images to keep the content position, I'd like to use any HTML content within these screens. I'd also like to eventually ad a parallax effect similar to this.
So let's break it down. I got these background images on these screen elements. The background is fixed so it stays in the same position when you scroll. When you scroll down, the element moves out of view and another comes into view. It gives this effect as though the scrolling is causing a cover to slide up and reveal another screen. I want to keep this effect only without using background images. So I'll need some way to have some content remain fixed and have a contain hide it when it overflows an element that isn't fixed. But, as far as I know, there's no way to do this with CSS alone, am I wrong?
Like I said above, it would be interesting to have the content not remain exactly fixed, but instead slightly move it as you scroll giving it a slightly parallax effect. In order to do that tho, I'll need to use JavaScript. But, that's a bit out of the scope of my question, but I'd like to keep this in mind when coming up with the solution.
Thanks for all help in advance!

Diagonal background css without image

I'm trying to make a diagonal background with CSS.
Why not use images? Because I want to make a parallax effect later and I can not do it with images due to some factors.
You can see here the page:
http://jsfiddle.net/2ABd4/6/
As you can see, the result is the one I want. The problem is that the layer named "bg1" and "bg2" have a fixed position.
position: fixed;
I do not want it to be fixed.
But if I put an absolute position is off to the right.
So, I need this result to remain diagonal, without being fixed without dislodging the page to the right. The question is: Is it possible to do this?

Can I make this breadcrumb using css3?

I have been trying to make this PSD using CSS?
So far I have reached this. Can I achieve this design using CSS3 or do I have to use old school background image method?
In short, yes this is possible with CSS alone (without CSS2 even), but I would urge you to use background images instead.
Ranting
The problem with doing CSS like this is shadows. The way it renders the triangle is just a border that is transparent on the diagonal sides. In other words, your shadow would still be a box and would not look the way you want it to.
I see this a lot with people starting to use CSS3. They normally want everything done dynamically instead of with background images. And once it's done, there's this slew of CSS that barely does anything aesthetically for the page. In reality, it only takes 10-15% of what they end up with to achieve the same effect with images.
There isn't any problem with background images, they aren't going out of style, and they certainly won't stop working any time soon. My advice, stick with background images for what needs an image, and save CSS3 for special effects. It sounds boring and old-school, but it works and is a whole lot easier.
This seems like a relatively simple CSS project; simple, here, being relative, as I've seen people make an animated Twitter Fail Whale with CSS alone.
What you're going to have to do for the triangle edges (which I assume is the tricky part for you), is use the CSS matrix transform (elaborated on at W3Schools), and then just use box-shadow for the borders, and box-shadow: inset for the inset effect. Afterwards, just use appropriate padding and text alignment to get the text centred in each part of the object.
EDIT
Consider using the before and after pseudo elements to achieve this. Alternatively, you can use two skewed <div>s stacked on top of eachother for each section; however, this wouldn't give you an attractive shadow.
I don't think it is possible with CSS alone. You will have to make use of background image. You will be able to create the tapered edge effect using :after and :before psuedo classes. But will face problem with the inside shadow.
I once tried to create a similar breadcrumb using css3 alone when I saw the breadcrumb in Google Help Center (which is similar, but using background image), but was not able to do it.
http://support.google.com/adsense/bin/answer.py?hl=en&answer=1354760
I tried to do it with CSS (:after and :before) pseudo elements, without adding any other html elements.