Problem with sticky position and element overlapping another element - html

I made a page using HTML and CSS only. Tried to make it responsive. I say, I managed that, but there are some issues. First is, my navigation is not sticky. I wanted it to stick to the top when I scroll, but it does not work. Second thing is, when I resize the screen for mobile device, div with class "kid desni" goes over div with class="kid levi". Why is that happening? Also, on bigger screen, div with class="kid levi" and div with class="kid desni" should be aligned next to each other, but div with class "desni" is a bit higher than it should be. And the img does not take full space of its parent div. Third thing is, do you know how to make that blue part "why adventure travel" look like that? And fourth, those small images bellow are cut on the bottom, if you can see, a little bit. How do I do that? I hope you understand what I am trying to achieve here. :) Here is part of HTML code that I want to fix:
<div class="container">
<header class="" >
<div style="height: 30px;">
<nav>
<div class=logo>
<img src="images/logoicon.png" alt="sunce">
<img src="images/logotext.png" alt="outdoors" id="logotext"></a>
</div>
<ul class="nav-ul">
<li>Destinations</li>
<li>Travel style</li>
<li>Trabel deals</li>
<li>Gear</li>
</ul>
<div class="forma">
<input type="search" placeholder="search" class="pretraga">
<i class="fa fa-search"></i>
</div>
</nav>
</div>
</header>
<main>
<h1 style="text-align: center; margin-top: 70px;">CONNECT TO THE WORLD</h1>
<div class="content">
<div class="kid levi">
<div>
<h3>Our worls deservs more you</h3>
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Suscipit tempore
velit impedit praesentium corporis sunt iure eaque, laudantium mollitia dicta eos eum
assumenda inventore itaque qui harum repudiandae error repellat.
</div>
<div>
<h3>Whatever your style see it your way</h3>
Lorem ipsum dolor, sit amet consectetur
adipisicing elit. Quisquam nihil, maiores soluta eos modi dolor error. Accusamus saepe mollitia
eaque, possimus fuga libero voluptatum consectetur asperiores vitae porro voluptatibus velit?
</div>
</div>
<div class="kid desni"> <!-- this is the div with and img that needs to be aligned and overlaps div above on small screen -->
<div>
<img src="images/img-connect.jpg" alt="conn" id="conn"
style="max-width: 80%; max-height: auto; margin-top: 50px;" >
</div>
</div>
</div><br>
And here is CSS:
nav {
background-color: steelblue;
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
position: sticky;
top: 0;
}
.nav-ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
/* background-color: #333; */
}
.nav-ul li {
display: inline;
float: left;
}
.nav-ul li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
.nav-ul li:last-child {
float: right;
}
.nav-ul li a:hover:not(.active) {
background-color: #111;
}
#logotext {
margin-bottom: 10px;
margin-left: 10px;
}
main {
width: 95%;
margin: auto;
}
.content {
display: flex;
margin-bottom: 70px;
}
.levi {
display: flex;
flex-direction: column;
}
.kid {
display: flex;
width: 100%;
height: 200px;
align-items: center;
margin: 0;
}
And this is for smaller screen:
#media screen and (max-width: 768px) {
nav {
display: block;
text-align: center;
}
.nav-ul,
.nav-ul li {
float: none;
}
.nav-ul li:last-child {
float: none;
}
.container {
width: 100%;
}
.content {
/* display: block; */
flex-direction: column;
}
.kid {
/* display: block; */
}
.levi {
/* display: block; */
}
.desni {
display: none;
}
This is how it's suppose to look:
This is how I made it. Big and small screen are shown.

Related

How to make an image fit its content

[Tree with all its leaves off the brancges[1]
[1]: https://i.stack.imgur.com/hfQGM.png
Im trying to make the image fit to the bottom left and top of the inside border, but not the right i just want it to fit in that certain space.
This is what i have so far...
<section class="winter">
<div class="outside-border">
<div class="section-heading">
<h2>Winter</h2>
</div>
<div class="inside-border">
<div class="winter-image">
<a href="winter.html">
<img src="assets/images/winter.jpg" alt="Winter Image">
</a>
</div>
<div class="section-content">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Impedit dolore enim sequi dignissimos vel fugit
reiciendis minus voluptatem nostrum, at repellat odio libero cum eveniet officiis, cumque veritatis, qui
eaque.</p>
</div>
</div>
</div>
css
.outside-border{
border: 2px solid var(--winter-primary);
margin: auto;
max-width: 1000px;
background-color: white;
padding: 20px;
margin-bottom: 20px;
}
.section-heading{
width: 100%;
background-color: var(--winter-primary);
text-align: center;
}
.section-heading>h2 {
margin: 0;
}
.inside-border{
border: 2px solid var(--winter-primary);
display: flex;
align-items: center;
background-color: var(--winter-light);
}
.section-content{
background-color: var(--winter-light);
}
.winter-image{
display: inline-flex;
background-size: cover;
}
p{
margin-left: 1em;
text-align: center;
padding: 10px;
}
Now im just saying the same thing over and over again because im a stupid newbe coder that is having trouble with this problem. Stack overflow says i need to add more words because all i have is code right now.
try to put margin and padding 0.
hope this helps
.winter-image{
display: inline-flex;
background-size: cover;
margin: 0;
padding: 0;
}

How to fix Component-Streching when using vh with flexbox?

I am trying to layout a website using flexbox layout. The main goal is to have a header, a footer and a navigation to the left. The main and aside parts are to be placed in the middle and to the right. So far i got it to work using the following:
html {
font-family: sans-serif;
font-size: 1rem;
}
* {
box-sizing: border-box;
padding: 0;
border: 0;
margin: 0;
}
html * {
/* debugging */
border: 1px dotted hotpink;
}
body {
display: flex;
flex-flow: row wrap;
/* height: 100vh; */
}
nav {
width: 10%;
}
main {
width: 75%;
}
aside {
width: 15%;
}
header, footer {
width: 100%;
text-align: center;
background-color: hotpink;
}
main {
flex: 1 1 auto;
}
nav {
background-color: lightblue;
}
nav ul {
display: flex;
flex-flow: column nowrap;
list-style-type: none;
}
nav ul li:hover {
background-color: royalblue;
}
nav ul li a {
display: block;
text-decoration: none;
padding: 0.5em;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="main.css">
<title>Document</title>
</head>
<body>
<header>
<h1>THIS IS THE REALLY BIG HEADER</h1>
</header>
<nav>
<ul>
<li>menu1</li>
<li>menu2</li>
<li>menu3</li>
<li>menu4</li>
<li>menu5</li>
</ul>
</nav>
<main>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fuga unde consequatur laborum cupiditate odio ipsa
cumque, dolorem temporibus aut ipsam commodi autem maiores delectus non vitae recusandae magni consequuntur ab!
</main>
<aside>aside</aside>
<footer>(c) by me</footer>
</body>
</html>
However: When using the line
/* height: 100vh; */
all components are stretched to use the whole screen-height. My intent is to just make the navigation, main and aside stretch, but let the header and footer use only the space they need. How can i accomplish this?
You can do the following:
1) Set for <body> tag property
flex-flow: column;
min-height: 100vh;
2) Add wrapper for tags <nav>, <main>, <aside>and set for this properties
flex-grow: 1;
display: flex;
Result
html {
font-family: sans-serif;
font-size: 1rem;
}
* {
box-sizing: border-box;
padding: 0;
border: 0;
margin: 0;
}
html * {
/* debugging */
border: 1px dotted hotpink;
}
body {
display: flex;
flex-flow: column;
min-height: 100vh;
}
nav {
width: 10%;
}
main {
width: 75%;
}
aside {
width: 15%;
}
header,
footer {
width: 100%;
text-align: center;
background-color: hotpink;
}
main {
flex: 1 1 auto;
}
nav {
background-color: lightblue;
}
nav ul {
display: flex;
flex-flow: column nowrap;
list-style-type: none;
}
nav ul li:hover {
background-color: royalblue;
}
nav ul li a {
display: block;
text-decoration: none;
padding: 0.5em;
}
.page {
flex-grow: 1;
display: flex;
}
<header>
<h1>THIS IS THE REALLY BIG HEADER</h1>
</header>
<div class="page">
<nav>
<ul>
<li>menu1</li>
<li>menu2</li>
<li>menu3</li>
<li>menu4</li>
<li>menu5</li>
</ul>
</nav>
<main>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fuga unde consequatur laborum cupiditate odio ipsa cumque, dolorem temporibus aut ipsam commodi autem maiores delectus non vitae recusandae magni consequuntur ab!
</main>
<aside>aside</aside>
</div>
<footer>(c) by me</footer>
And same code on CodePen
Do this:
body {
display: flex;
flex-flow: row wrap;
align-items: flex-start;
}

How to make image gallery centered

I need help in centering my image gallery, i cant make it to work how i want, gutters are being pain in the ass and so are calculating margins and widths. I want images centered, so three images per row, with one image being all the way to the left, second image being centered and third image being all the way to the right, using margins and padding with floats individually I believe is a bad practice, there has to be a better way to do this. Each image is 295px width I changed their widths in photoshop. I don't wish to use css grid, flexbox etc… I just want to do it in basic way with floats and box model. If there is any good way to center these images with some space in between them.
/* CSS Document */
/*body {
margin: 20px 250px;
}*/
#wrapper {
width: 1000px;
margin: 20px auto;
}
header {
background-image: url("../Images/view2.jpg");
background-repeat: no-repeat;
text-align: center;
padding-top: 30px;
padding-bottom: 20px;
}
header #navbar {
margin-top: 35px;
}
#navbar a {
padding: 30px 35px;
}
header h1 {
margin: 0;
}
main {
background: rgba(211, 204, 38, 1.00);
overflow: hidden;
padding: 20px;
}
main #page {
text-align: center;
}
main #inner-content ul {
list-style: none;
}
main #inner-content {
overflow: hidden;
padding-left: 17.7px;
}
main #inner-content #block1 {
float: left;
padding: 0;
width: 33.33%;
}
main #inner-content #block2 {
float: left;
padding: 0;
width: 33.33%;
}
main #inner-content #block3 {
float: left;
padding: 0;
width: 33.33%;
}
main #inner-content #block1 li {
margin-left: 12.5px;
}
main #inner-content #block2 li {
margin-left: 12.5px;
}
main #inner-content #block3 li {
margin-left: 12.5px;
}
#about-text {
margin-bottom: 50px;
text-align: center;
}
footer {
background: rgba(96, 96, 96, 1.00);
padding: 20px;
overflow: hidden;
clear: left;
}
footer #contact {
float: left;
margin-left: 200px;
}
footer #form {
float: right;
margin-right: 200px;
}
<div id="wrapper">
<header id="header">
<h1>ISMAR PHOTOGRAPHY</h1>
<nav id="navbar">
HOME
ABOUT
SERVICES
CONTACT
PORTFOLIO
</nav>
</header>
<main>
<p id="about-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nihil error aspernatur vitae illo animi aliquam perferendis dicta, temporibus, dolores suscipit accusantium cumque voluptas nesciunt pariatur numquam omnis quo sunt minus voluptatum vero odio
ipsam mollitia. Itaque consequatur non harum molestias quibusdam voluptatem provident, eius, aliquam magnam, nesciunt ipsum est maiores! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sed beatae veritatis provident expedita facere dolore
saepe autem cupiditate voluptas assumenda enim odit illum et placeat amet officiis, accusamus adipisci veniam, hic. Velit fugiat vitae, laboriosam omnis voluptates rem, totam esse quisquam sunt hic voluptatum amet quam repudiandae sequi incidunt
nam!</p>
<p id="page">01</p>
<div id="inner-content">
<ul id="block1">
<li><img src="Images/nature.jpg"></li>
<li><img src="Images/panorama.jpg"></li>
<li><img src="Images/self.jpg"></li>
</ul>
<ul id="block2">
<li><img src="Images/self2.jpg"></li>
<li><img src="Images/sky.jpg"></li>
<li><img src="Images/telex.jpg"></li>
</ul>
<ul id="block3">
<li><img src="Images/urban-beatz.jpg"></li>
<li><img src="Images/urban-beatz2.jpg"></li>
<li><img src="Images/view.jpg"></li>
</ul>
</div>
</main>
<footer>
<div id="contact">
<h2>CONTACT ME</h2>
<p>randomemail#gmail.com</p>
<p>+456 34 55 5567</p>
</div>
<form action="#" name="form" id="form">
<label for="name">Name</label><br>
<input type="text" id="name"><br>
<label for="last-name">Last name</label><br>
<input type="text" id="last-name"><br>
<label for="email">Email</label><br>
<input type="text" id="email"><br>
<label for="message">Message</label><br>
<input type="text" id="message"><br>
</form>
</footer>
</div>
Okay, if you don't want to use grid or flexbox, then I'd suggest the old school table is a good option.
.my-table {
width: 100%;
}
.my-table td {
/* Change this padding to add gutters of desirable size*/
padding: 20px;
}
.my-table img {
width: 100%;
height: auto;
}
<table class="my-table">
<tr>
<td><img src="image_1_location.jpg" /></td>
<td><img src="image_2_location.jpg" /></td>
<td><img src="image_3_location.jpg" /></td>
</tr>
<tr>
<td><img src="image_4_location.jpg" /></td>
<td><img src="image_5_location.jpg" /></td>
<td><img src="image_6_location.jpg" /></td>
</tr>
</table>
Option 2
There is another way you can achieve this with floats if you want.
The only thing is that you'll have to make multiple containers to accommodate for the floats.
Here's how you can do it
.my-image-gallery {
position: relative;
}
.clearfix:after {
content: " ";
visibility: hidden;
display: block;
height: 0;
clear: both;
}
.floating-element {
float: left;
width: 33.33%;
}
.image-container {
padding: 10px;
}
.image-container>img {
width: 100%;
height: auto;
}
<div class="my-image-gallery">
<div id="row-1" class="clearfix">
<!-- You'll need to make a container for each image -->
<div class="floating-element">
<div class="image-container">
<img src="google-logo.png" />
</div>
</div>
<div class="floating-element">
<div class="image-container">
<img src="google-logo.png" />
</div>
</div>
<div class="floating-element">
<div class="image-container">
<img src="google-logo.png" />
</div>
</div>
</div>
</div>
While I think this is a riduculous way of doing this. You can use calc() to add a margin on both sides of the center img this example is using your current markup with no flex:
li:nth-child(2) {
margin: 0 calc(50% - 408px);
}
li {
width: 259px;
height: 259px;
list-style-type: none;
background-color: lightblue;
display: inline-block;
}
https://jsfiddle.net/DIRTY_SMITH/0f78ksvx/12/
The better way that you don't want to do would be to use flex:
#block1{
display: flex;
justify-content: space-between;
}
https://jsfiddle.net/DIRTY_SMITH/0f78ksvx/3/
Below are some minimal examples of how to implement your gallery. The concept is the same for both the Flexbox and Float approaches. Tell each image that it should be 1/3 the width of the container element (including margin) and allow the images to wrap inside their container element.
The overflow and negative margin properties used in both "remove" the outermost margins and may not be something that you desire or are concerned with.
Using Flexbox
body {
margin: 2rem;
}
.container {
margin-left: auto;
margin-right: auto;
width: 75%;
overflow: hidden;
}
.gallery {
display: flex;
flex-wrap: wrap;
align-items: center;
margin: -1rem;
background-color: rgba( 111, 222, 50, 0.15);
}
.gallery img {
display: flex;
margin: 1rem;
width: calc( 33.33333% - 2rem );
}
<div class="container">
<div class="gallery">
<img src="https://via.placeholder.com/300x300/fc0">
<img src="https://via.placeholder.com/300x300/">
<img src="https://via.placeholder.com/300x300/d10">
<img src="https://via.placeholder.com/300x300/">
<img src="https://via.placeholder.com/300x300/d10">
<img src="https://via.placeholder.com/300x300/fc0">
<img src="https://via.placeholder.com/300x300/d10">
<img src="https://via.placeholder.com/300x300/fc0">
<img src="https://via.placeholder.com/300x300/">
</div>
</div>
Using Floats
I highly recommend moving away from floats and using Flexbox or CSS Grid unless there is a specific behavior that floats provide that favors some requirement.
body {
margin: 2rem;
}
.container {
margin-left: auto;
margin-right: auto;
width: 75%;
overflow: hidden;
}
.gallery {
margin: -1rem;
overflow: hidden;
background-color: rgba( 111, 222, 50, 0.15 ); /* For illustrative purposes. */
}
.gallery img {
float: left;
margin: 1rem;
max-width: calc( 33.33333% - 2rem); /* Subtract left and right margins */
}
<div class="container">
<div class="gallery">
<img src="https://via.placeholder.com/300x300/fc0">
<img src="https://via.placeholder.com/300x300/">
<img src="https://via.placeholder.com/300x300/d10">
<img src="https://via.placeholder.com/300x300/">
<img src="https://via.placeholder.com/300x300/d10">
<img src="https://via.placeholder.com/300x300/fc0">
<img src="https://via.placeholder.com/300x300/d10">
<img src="https://via.placeholder.com/300x300/fc0">
<img src="https://via.placeholder.com/300x300/">
</div>
</div>
body {
margin: 2rem;
}
.container {
margin-left: auto;
margin-right: auto;
width: 75%;
overflow: hidden;
}
.gallery {
overflow: hidden; /* For illustrative purposes. */
background-color: rgba( 111, 222, 50, 0.15 ); /* For illustrative purposes. */
}
.gallery img {
float: left;
margin: 1rem;
max-width: calc( 33.33333% - 2rem); /* Subtract left and right margins */
}
<div class="container">
<div class="gallery">
<img src="https://via.placeholder.com/300x300/fc0">
<img src="https://via.placeholder.com/300x300/">
<img src="https://via.placeholder.com/300x300/d10">
<img src="https://via.placeholder.com/300x300/">
<img src="https://via.placeholder.com/300x300/d10">
<img src="https://via.placeholder.com/300x300/fc0">
<img src="https://via.placeholder.com/300x300/d10">
<img src="https://via.placeholder.com/300x300/fc0">
<img src="https://via.placeholder.com/300x300/">
</div>
</div>
use the html
<center>
image code here
</center>
<right>
and
<left>

Overlay Not Covering Entire Header

I'm not really sure how to word this question but I'll try.
So, I'm trying to get an overlay over the top of a background image, the header itself is taking up 100vh, but when I place the overlay with the image included, some padding from the nav is pushing the background colour down below the viewport it seems. I've tried to take margin off the nav elements and it brings the background up a little but not all the way. Maybe I'm missing something very simple here but I just can't seem to get my head around it.
Here's a link to the codepen (I know the code is a bit of a mess, it's just a test): https://codepen.io/Jmp93/pen/BMJwov
<nav id="main-nav">
<h3>TEST|Web</h3>
<ul>
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ul>
</nav>
<header>
<h1>Test Text Sample</h1>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Sunt dolores, dolorum minima id beatae aperiam saepe
sapiente animi quas earum?</p>
</header>
<section id="start-section">
<div class="container">
<h1 class="m-heading">Some Text</h1>
<p class="lead">Lorem ipsum dolor sit amet consectetur adipisicing elit. Dicta possimus dolore temporibus aut,
reiciendis voluptatum voluptate consequatur ducimus. Sunt minus nihil nulla in commodi. In officiis, harum amet
eos nesciunt illum rerum aliquam quasi modi natus quis laudantium qui quae?</p>
</div>
</section>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, Helvetica, sans-serif;
background: #333;
color: #fff;
margin: 0;
line-height: 1.5;
}
.m-heading {
font-size: 2rem;
margin-bottom: .75rem;
}
.lead {
font-size: 1.2rem;
}
header {
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
height: 100vh;
text-align: center;
}
header:before {
content: '';
background: url('https://source.unsplash.com/1600x900/?nature,water') no-repeat center center/cover;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.2;
z-index: -1;
}
header h1 {
font-size: 4rem;
margin: 1rem;
}
#main-nav {
display: flex;
position: sticky;
top: 0;
left: 0;
justify-content: space-between;
}
#main-nav h3 {
font-size: 2rem;
margin: 2rem;
}
#main-nav ul {
display: flex;
justify-items: center;
font-size: 1.2rem;
margin: 2rem;
}
#main-nav ul li {
list-style: none;
}
#main-nav ul li a {
color: #fff;
text-decoration: none;
padding: 1rem;
}
#main-nav ul li a:hover {
background: #444;
border-radius: 25px;
}
.container {
max-width: 900px;
margin: 0 auto;
padding: 2rem;
}
#start-section {
background: #fff;
color: #000;
text-align: center;
}
Any help would be appreciated, thanks.
Just try to apply a position relative to the header itself :) usually if you use a position absolute, the main element containing it should be relative. That is the correct way of making the absolute element be positioned at 100% of its parent's width and height and not floating without reference.

How to properly format a bleeding image so that it appears in proper ratio

I have a container that is keeping the content to a max-width of 1200px and want to have a main image that is placed as the background of the .main_prize_section and can expand on bigger screens while staying within the proper aspect ratio. the main wrapper image is like a container for the main content, so it cant appear distorted.
here is the html code
<section class="main_prize_section">
<div class="container">
<div>
<div class="row">
<div class="flex_row">
<div class="col_1_2">
<div>
<h1>TEST HEADER</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos quae quo fugit asperiores, aperiam perspiciatis dolores consectetur quam nemo, laudantium et doloribus officia voluptates eveniet optio ad ab quaerat natus!</p>
</div>
<div>
<h2>sub header</h2>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Corrupti accusantium molestiae id a quae pariatur? Sequi ipsum quos libero aspernatur tempore molestiae facere, porro, autem perferendis, atque aut earum reiciendis.</p>
</div>
</div>
<div class="col_1_2 main_prize_product"><img src="images/english/prize_images.png" alt="" width="100%"/></div>
</div>
</div>
</div>
</div>
</section>
here is the css code
.container {
max-width: 1200px;
margin: 0 auto;
}
.flex_col {
-webkit-flex-direction: column;
-moz-box-orient: vertical;
-moz-box-direction: normal;
flex-direction: column;
display: -webkit-flex;
display: -moz-box;
display: flex;
}
.flex_row {
display: -webkit-flex;
display: -moz-box;
display: flex;
}
.col_1_2 {
width: 50%;
}
.main_prize_section {
text-align: center;
background: url("../images/prize_background.png");
background-repeat: no-repeat;
background-size: 100%;
width: 100%;
background-position: 50% 50%;
text-align: center;
}
.main_prize_section img {
width: 50%;
margin: 0 auto;
}
.main_prize_section .flex_row {
padding: 2%;
}
.main_prize_section h1 {
color: pink;
font-size: 4rem;
font-weight: 700;
}
.main_prize_section h2 {
color: pink;
font-size: 2.5rem;
font-weight: 700;
}
.main_prize_section .col_1_2 div:nth-child(2) {
padding: 2%;
}
.main_prize_section p:nth-child(2) {
padding: 2%;
}
.main_prize_section p span:nth-child(1) {
color: gold;
}
.main_prize_section p span:nth-child(2) {
color: pink;
}
.main_prize_section p span:nth-child(3) {
color: red;
}
.main_prize_section p span:nth-child(4) {
color: blue;
}
the main wrapper image that bleeds out is 1366x800.
See if this helps you: https://codepen.io/panchroma/pen/jxxoqO
The important bit is the CSS lines 36 - 39
.main_prize_section {
...
background:url("../images/prize_background.png");
background-repeat: no-repeat;
background-size:cover; /* could also be background-size:contain; */
background-position:50% 50%; /* adjust to fit your design and the image */
}
For the background size, use either 'cover' or 'contain', and in combination with the background-position values, find a combination of settings that work for your specific design and image.
Good luck!