Set space between divs

Float them both the same way and add the margin of 40px. If you have 2 elements floating opposite ways you will have much less control and the containing element will determine how far apart they are.

HTML iframe – disable scroll

Unfortunately I do not believe it’s possible in fully-conforming HTML5 with just HTML and CSS properties. Fortunately however, most browsers do still support the scrolling property (which was removed from the HTML5 specification). overflow isn’t a solution for HTML5 as the only modern browser which wrongly supports this is Firefox. A current solution would be … Read more

How to make blinking/flashing text with CSS 3

You are first setting opacity: 1; and then you are ending it on 0, so it starts from 0% and ends on 100%, so instead just set opacity to 0 at 50% and the rest will take care of itself. Demo  Run code snippetExpand snippet Here, I am setting the animation duration to be 1 second, and then I am setting the timing to linear. That means it will … Read more

How to display hr horizontally with flex?

Use flex-grow: 1 or width: 100% so it will grow to match the width of the parent. You probably want to use that in combination with flex-wrap: wrap on .container if you plan on putting more flex children in .container

Adding background image to div using CSS

You need to add a width and a height of the background image for it to display properly. For instance, As you mentioned that you are using it as a shadow, you can remove the width and add a background-repeat (either vertically or horizontally if required). For instance, PS: XX is a dummy value. You need to replace it with your actual values … Read more

What does an asterisk (*) do in a CSS selector?

It is a wildcard, this means it will select all elements within that portion of the DOM. For example, if I want apply margin to every element on my entire page you can use: You can also use this within sub-selections, for example the following would add a margin to all elements within a paragraph … Read more

HTML/CSS float: left; is not working properly

First, it might be the issue that you are adding margin and paddings, which add size to the box even though the box has a width of 420px, you have to calculate margins and paddings to, or use * { box-sizing: border-box; }, which will calculate the width of that element as a sum of all … Read more