How to add 10px between images using CSS?

If we use box-sizing: border-box; then you can just apply borders to specific elements without breaking the layout. you could make the entire gallery 10px wider than the screen and have a 5px padding (that is for two images in a row). Alternatively you might have a padding around the images a have the left

How to set container size equal to background image size using CSS

Instead of using a background image, you could use a img element and set the containing div’s display to inline-block. You’d then need to create an inner div to wrap the content and position it absolutely relative to the containing div. Since the img is the only thing in the flow, the containing div will resize relative to the image.

How to get screen height in css?

You can’t “get” the viewport height as such, in the way that you can with JS to store it in a variable, but you can use it in calc() to change the height of elements. For example, height: calc( 100vh – 50px ); which would equate to “the window height less 50px”