1

I tried to create a parallax image using css. I have created it, but image not showing full div. I mean background size is not cover. How can I do it full ?

For example, when I apply this, image shows full div.

<link href='https://cdnjs.cloudflare.com/ajax/libs/tailwindcss/2.2.19/tailwind.min.css' rel='stylesheet'/>  

<div class="bg-center bg-no-repeat bg-cover w-full h-80" style="background-image: url(https://img.freepik.com/premium-photo/creative-idea-with-brain-light-bulb-illustration-generative-ai_438099-13380.jpg)">
</div>

But when I add bg-fixed (background-position: fixed;), image resizes and not showing full div.

Like That enter image description here

How can I show full div image with parallax (No JS)

2 Answers 2

0

instead using background-size:cover, use background-size: 100% 100%. The image will be distorted but will take 100% of the div.

Sign up to request clarification or add additional context in comments.

1 Comment

This is not any good solution.
0

please change your height class from h-80 to h-100 now your background image shows in full screen.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.