How to force display contents outside its parent container in css - html

I'm trying to create an E-commerce site, I have different categories(phone, computers, etc) and each category has a drop-down box.
My problem is displaying the drop-down contents outside its parent element and still be able to scroll horizontally(overflow-x : auto)
Each time I add an overflow-x:auto;, the drop down list becomes inside of the parent container.
.carte {
position: fixed;
top: 60px;
right: 0;
width: 100vw;
overflow-x: auto;
/*makes drop down boxes(.innerCart ) not visible*/
padding-bottom: 100px;
display: flex;
background: red;
z-index: 1;
}
.category {
position: absolute;
top: 60px;
padding: 5px 0;
margin: 0;
background: #fff;
border-bottom: 1px solid #A8A8A8;
border-radius: 0 0 0 5px;
display: flex;
justify-content: center;
overflow: visible;
}
.cart {
position: relative;
}
.outerCart {
padding: 10px;
margin: 0 7px;
border-radius: 5px;
cursor: pointer;
position: relative;
max-height: 100px;
overflow: hidden;
}
.innerCart {
display: none;
transition: 0.5s;
position: absolute;
top: 100px;
left: 50%;
transform: translate(-50%, 0);
background-color: #fff;
border-radius: 5px;
padding: 10px;
box-shadow: 0 0 10px #BABABA;
width: auto;
max-height: 300px;
overflow-y: auto;
}
.cart:hover .innerCart {
display: block;
}
.innerCart p:hover {
background: #f4f4f9;
color: rgb(59, 56, 56);
}
<div class="carte">
<div class="category" id="categorny">
<div class="cart">
<div class="outerCart">
<img src="/shop/images/phone-icon.png" class="phoneimage">
<p>Phones</p>
</div>
<div class="innerCart">
<p onclick="location.href='phones/android/index.html' ">Android</p>
<div class="line"></div>
<p onclick="location.href='phones/ios/index.html' ">IOS</p>
<div class="line"></div>
<p onclick="location.href='phones/accessories/index.html' ">Accessories</p>
</div>
</div>
<div class="cart">
<div class="outerCart">
<img src="<?php echo $stream?>/images/computer-icon.png" class="phoneimage">
<p>Computers</p>
</div>
<div class="innerCart">
<!-DROP DOWN CONTENT FOR COMPUTERS-->
</div>
</div>
<div class="cart">
<div class="outerCart">
<img src="<?php echo $stream?>/images/electronics-icon.png" class="electronicimage">
<p>Electronics</p>
</div>
<div class="innerCart">
<!-DROP DOWN CONTENT FOR ELECTRONICS-->
</div>
</div>
<div class="cart">
<div class="outerCart">
<img src="<?php echo $stream?>/images/fashion-icon.png" class="clothingimage">
<p>Fashion</p>
</div>
<div class="innerCart">
<!-DROP DOWN CONTENT FOR FASHION-->
</div>
</div>
<div class="cart">
<div class="outerCart">
<img src="<?php echo $stream?>/images/beauty-icon.png" class="clothingimage">
<p>Beauty</p>
</div>
<div class="innerCart">
<!-DROP DOWN CONTENT FOR BEAUTY-->
</div>
</div>
<div class="cart">
<div class="outerCart">
<img src="<?php echo $stream?>/images/vehicle-icon.png" class="vehicleimage">
<p>Vehicles</p>
</div>
<div class="innerCart">
<!-DROP DOWN CONTENT FOR VEHICLES-->
</div>
</div>
<div class="cart">
<div class="outerCart">
<img src="<?php echo $stream?>/images/service-icon.png" class="serviceimage">
<p>Services</p>
</div>
<div class="innerCart">
<!-DROP DOWN CONTENT FOR SERVICES-->
</div>
</div>
<div class="cart">
<div class="outerCart">
<img src="<?php echo $stream?>/images/house-icon.png" class="houseimage">
<p>Housing/property</p>
</div>
<div class="innerCart">
<!-DROP DOWN CONTENT FOR PROPERTY->
</div>
</div>
<div class="cart">
<div class="outerCart">
<img src="<?php echo $stream?>/images/food-icon.png" class="foodimage">
<p>Food/bakes</p>
</div>
<div class="innerCart">
<!-DROP DOWN CONTENT FOR FOODS->
</div>
</div>
<div class="cart">
<div class="outerCart">
<img src="<?php echo $stream?>/images/pet-icon.png" class="foodimage">
<p>Livestock/Pets</p>
</div>
<div class="innerCart">
<!-DROP DOWN CONTENT FOR PETS->
</div>
</div>
<i class="fa fa-arrow-right" id="arrow"></i>
</div>
</div>

Related

How to create this css grid

I want to acheive this design any next category will automatically adjust to the previous div. Every category have not specific product but need to just after the previous product like we use float left or display-flex But don't want to create multiple css for responsive. Because it has more than 25 categories. `
.offerpage .product-box {
margin: 0 5px;
}
.categoryProductsWrap{
width: 100%;
}
.product-img{
width: 100%;
}
.categoryProductsWrap .categoryProducts {
display: flex;
flex-wrap: wrap;
width: 100%;
}
.categoryProductsWrap .categoryProducts .product-box {
margin-bottom: 10px;
float: left;
}
.offerpage .categoryName {
color: #161719;
font-size: 24px;
font-weight: bold;
margin-bottom: 0.5em;
border-bottom: solid 1px #dddddd;
padding-bottom: 0.125em;
}
.img-box{
position: relative;
padding-top: 124%;
display: inline-block;
width: 100%;
vertical-align: top;
}
.product-box .product-img{
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}
.img-responsive {
display: block;
max-width: 100%;
height: auto;
}
.txt-content {
overflow: hidden;
position: relative;
}
.img-box{
position: relative;
padding-top: 124%;
display: inline-block;
width: 100%;
vertical-align: top;
}
.offerpage{
display: flex;
flex-wrap: wrap;
}
.categoryProductsWrap .categoryProducts .product-box{
width: 33.333%
}
#media (min-width: 1200px){
.categoryProductsWrap.cooling_fan {
width: 50%;
}
.categoryProductsWrap.accessories {
width: 50%;
}
}
#media (min-width: 1440px){
.categoryProductsWrap.accessories .categoryProducts .product-box,
.categoryProductsWrap.cooling_fan .categoryProducts .product-box {
width: calc(50% - 10px);
}
}
<div class="offerpage">
<div class="categoryProductsWrap accessories">
<div class="categoryName">Accessories</div>
<div class="categoryProducts clearfix offerzone-slider products-wrapper">
<div class="product-box">
<div class="product-inner-box">
<div class="txt-content">
<div class="img-box">
<a href="#" class="product-thumbnail">
<img class="product-img img-responsive" src="https://picsum.photos/400">
</a>
</div>
</div>
</div>
</div>
<div class="product-box">
<div class="product-inner-box">
<div class="txt-content">
<div class="img-box">
<a href="#" class="product-thumbnail">
<img class="product-img img-responsive" src="https://picsum.photos/400">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="categoryProductsWrap cooling_fan">
<div class="categoryName">Cooling Fan</div>
<div class="categoryProducts clearfix offerzone-slider products-wrapper">
<div class="product-box">
<div class="product-inner-box">
<div class="txt-content">
<div class="img-box">
<a href="#" class="product-thumbnail">
<img class="product-img img-responsive" src="https://picsum.photos/400">
</a>
</div>
</div>
</div>
</div>
<div class="product-box">
<div class="product-inner-box">
<div class="txt-content">
<div class="img-box">
<a href="#" class="product-thumbnail">
<img class="product-img img-responsive" src="https://picsum.photos/400">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="categoryProductsWrap asus">
<div class="categoryName">Asus</div>
<div class="categoryProducts clearfix offerzone-slider products-wrapper">
<div class="product-box">
<div class="product-inner-box">
<div class="txt-content">
<div class="img-box">
<a href="#" class="product-thumbnail">
<img class="product-img img-responsive" src="https://picsum.photos/400">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="categoryProductsWrap audio">
<div class="categoryName">Audio Device</div>
<div class="categoryProducts clearfix offerzone-slider products-wrapper">
<div class="product-box">
<div class="product-inner-box">
<div class="txt-content">
<div class="img-box">
<a href="#" class="product-thumbnail">
<img class="product-img img-responsive" src="https://picsum.photos/400">
</a>
</div>
</div>
</div>
</div>
<div class="product-box">
<div class="product-inner-box">
<div class="txt-content">
<div class="img-box">
<a href="#" class="product-thumbnail">
<img class="product-img img-responsive" src="https://picsum.photos/400">
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
`
If you want to use CSS grid, there no big difficulties simply check the documentation to understand the main CSS properties you need to add.
Also check this guide on CSS grid to undertand more and see examples.
Quick help
If I understand correctly you want 3 items max per row, to do that you will need to set:
grid-template-columns: repeat(3, 1fr);
The equivalent to flex-direction: row; is grid-auto-flow: row;
You will I presume also need a gap (spacing between items), something like that:
gap: 10px;
So a good starting point will be:
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-flow: row;
gap: 10px;
I leave you do the rest according to your needs.

Item moving around when window resized

See Umbrella image in images:
Full-size window:
.
Reduced (ideal placement):
I would like to have my umbrella image in the centre of the screen no matter the size of the window.
It works from the point where the window shrinks and works in mobile view too.
I've tried various methods but it doesn't seem to be working, any tips would be greatly appreciated.
Here is my code:
HTML
<div class="wrapper">
<div class="page2">
<h2>Blog</h2>
<div class="wrap">
<div class="card">
<a href="welcome.html">
<img class="card-img" src="str3.jpg">
</a>
<div class="card-text">
<h3>Welcome</h3>
<p>Website Launch and my First Project</p>
</div>
</div>
<div class="card">
<a href="blog.html">
<img class="card-img" src="steve_roe_kyoto.jpg">
</a>
<div class="card-text">
<h3> Kyoto</h3>
<p>My Recent Trip</p>
</div>
</div>
<div class="card">
<a href="best.html">
<img class="card-img" src="str4.jpg">
</a>
<div class="card-text">
<h3>Best of 2018</h3>
<p>Neon Goodness from Last Year</p>
</div>
</div>
</div>
<div class="page3">
<footer>
<div class="umbrella_icon">
<img src="umbrella-02.png">
</div>
<div class="logo_footer">Steve Roe</div>
<div class="footer_menu">
<ul class="ul_footer">
<li>Work With Me</li>
<li>
Contact</li>
</ul>
</div>
</footer>
</div>
</div>
</div>
CSS
.page2{
width: 100%;
margin: 0 auto;
margin-top: 20px;
height: 100%;
}
//cards
.wrap{
width:960px;
margin:auto;
margin-top: 100px;
}
.card{
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.15);
transition: 0.4s;
width: 300px;
text-align: center;
font-size: 16px;
float:left;
margin:10px;
text-decoration: none;
}
.page3{
margin: 20px;
margin-top: 20px;
height: 30%;
}
.umbrella_icon {
text-align: center;
}
.footer {
z-index: 1000;
width: 960px;
margin: 0 auto;
}
Use dispaly:flex to .wrap
See working code
.page2{
width: 100%;
margin: 0 auto;
margin-top: 20px;
height: 100%;
}
.wrap{
margin: auto;
margin-top: 100px;
display: flex;
}
.card{
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.15);
transition: 0.4s;
width: 300px;
text-align: center;
font-size: 16px;
float:left;
margin:10px;
text-decoration: none;
}
.page3{
margin: 20px;
margin-top: 20px;
height: 30%;
}
.umbrella_icon {
text-align: center;
}
.footer {
z-index: 1000;
width: 960px;
margin: 0 auto;
}
<div class="wrapper">
<div class="page2">
<h2>Blog</h2>
<div class="wrap">
<div class="card">
<a href="welcome.html">
<img class="card-img" src="str3.jpg">
</a>
<div class="card-text">
<h3>Welcome</h3>
<p>Website Launch and my First Project</p>
</div>
</div>
<div class="card">
<a href="blog.html">
<img class="card-img" src="steve_roe_kyoto.jpg">
</a>
<div class="card-text">
<h3> Kyoto</h3>
<p>My Recent Trip</p>
</div>
</div>
<div class="card">
<a href="best.html">
<img class="card-img" src="str4.jpg">
</a>
<div class="card-text">
<h3>Best of 2018</h3>
<p>Neon Goodness from Last Year</p>
</div>
</div>
</div>
<div class="page3">
<footer>
<div class="umbrella_icon">
<img src="umbrella-02.png" alt="umbrella">
</div>
<div class="logo_footer">Steve Roe</div>
<div class="footer_menu">
<ul class="ul_footer">
<li>Work With Me</li>
<li>
Contact</li>
</ul>
</div>
</footer>
</div>
</div>
</div>
End The page 2 div before starting page 3 div.
Change the page3 css to
.page3{
margin: 50vh 50vw;
}
<h2>Blog</h2>
<div class="wrap">
<div class="card">
<a href="welcome.html">
<img class="card-img" src="str3.jpg">
</a>
<div class="card-text">
<h3>Welcome</h3>
<p>Website Launch and my First Project</p>
</div>
</div>
<div class="card">
<a href="blog.html">
<img class="card-img" src="steve_roe_kyoto.jpg">
</a>
<div class="card-text">
<h3> Kyoto</h3>
<p>My Recent Trip</p>
</div>
</div>
<div class="card">
<a href="best.html">
<img class="card-img" src="str4.jpg">
</a>
<div class="card-text">
<h3>Best of 2018</h3>
<p>Neon Goodness from Last Year</p>
</div>
</div>
</div>
</div>
<div class="page3">
<footer>
<div class="umbrella_icon">
<img src="umbrella-02.png" alt="umbrella Here">
</div>
<div class="logo_footer">Steve Roe</div>
<div class="footer_menu">
<ul class="ul_footer">
<li>Work With Me</li>
<li>
Contact</li>
</ul>
</div>
</footer>
</div>
Use flex for .wrap like this :
.wrap{
width:960px;
margin:auto;
margin-top: 100px;
display: flex;
justify-content: center;
}
this code make image in center horizontally.

Same height and width of grid col cards html css BOOTSTRAP 3

This is what happend on my cards while having excess card in 1 row, I need it to be on the exact height and width even if different sizes of images. This is also in BOOTSTRAP 3
.card {
background-color: #fff;
border: 1px solid transparent;
border-radius: 6px;
}
.card>.card-link {
color: #333;
}
.card>.card-link:hover {
text-decoration: none;
}
.card>.card-link .card-img img {
border-radius: 6px 6px 0 0;
}
.card .card-img {
position: relative;
padding: 0;
display: table;
}
.card .card-img .card-caption {
position: absolute;
right: 0;
bottom: 16px;
left: 0;
}
.card .card-body {
display: table;
width: 100%;
padding: 12px;
}
.card .card-header {
border-radius: 6px 6px 0 0;
padding: 8px;
}
.card .card-footer {
border-radius: 0 0 6px 6px;
padding: 8px;
}
.card .card-left {
position: relative;
float: left;
padding: 0 0 8px 0;
}
.card .card-right {
position: relative;
float: left;
padding: 8px 0 0 0;
}
<div class="col-xs-6 col-sm-3">
<div class="card card-default">
<div class="card-img">
<img src="user_images/<?php echo $row['userPic'] ?>" alt="Card image" class="img-thumbnail" height="100">
</div>
<div class="card-body">
<p class="card-text" style="color:#00873a"><b><?php echo $cartname ?></b></p>
<p class="card-text" style="color:#e81b30"><strike style="color:#aaa">₱<?php echo $orig ?>.00</strike> ₱
<?php echo $cartprice ?>.00</p>
</div>
<div class="card-footer text-center">
<button type="button" class="btn btn-pink"><i class="fa fa-shopping-cart"></i> View Product </button></div>
</div>
</div>
I need to be on the same width and height so this not happen THANK YOUUU :(((
There are a few things you need to adjust. I have documented the changes in the source code.
The main container is changed into a flexbox. Since the default for flexbox items is stretch, all cards will have the same height.
Everything below the image is in a separate container and aligned to the bottom of the card.
/* Added */
.overview {
display: flex;
}
.card-default {
display: flex;
flex-wrap: wrap;
}
.card-default>* {
width: 100%;
}
.excludingImage {
align-self: flex-end;
text-align: center;
}
/* End Added */
.card {
background-color: #fff;
border: 1px solid transparent;
border-radius: 6px;
}
.card>.card-link {
color: #333;
}
.card>.card-link:hover {
text-decoration: none;
}
.card>.card-link .card-img img {
border-radius: 6px 6px 0 0;
}
/*
.card .card-img {
position: relative;
padding: 0;
display: table;
}
.card .card-img .card-caption {
position: absolute;
right: 0;
bottom: 16px;
left: 0;
}
*/
.card .card-body {
/* display: table;
width: 100%; */
padding: 12px;
}
.card .card-header {
border-radius: 6px 6px 0 0;
padding: 8px;
}
.card .card-footer {
border-radius: 0 0 6px 6px;
padding: 8px;
}
/*
.card .card-left {
position: relative;
float: left;
padding: 0 0 8px 0;
}
.card .card-right {
position: relative;
float: left;
padding: 8px 0 0 0;
}
*/
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<!-- Class overview is added -->
<div class="col-xs-6 col-sm-3 overview">
<div class="card card-default">
<div class="card-img">
<img src="https://via.placeholder.com/120x100" alt="Card image" class="img-thumbnail" height="100">
</div>
<!-- Extra div added to enable alignment at bottom -->
<div class="excludingImage">
<div class="card-body">
<p class="card-text" style="color:#00873a"><b>Cart name</b></p>
<p class="card-text" style="color:#e81b30"><strike style="color:#aaa">₱100.00</strike> ₱100.00</p>
</div>
<div class="card-footer text-center">
<button type="button" class="btn btn-pink"><i class="fa fa-shopping-cart"></i> View Product </button></div>
</div>
</div>
<div class="card card-default">
<div class="card-img">
<img src="https://via.placeholder.com/120x150" alt="Card image" class="img-thumbnail" height="100">
</div>
<!-- Extra div added to align at bottom -->
<div class="excludingImage">
<div class="card-body">
<p class="card-text" style="color:#00873a"><b>Cart name</b></p>
<p class="card-text" style="color:#e81b30"><strike style="color:#aaa">₱100.00</strike> ₱100.00</p>
</div>
<div class="card-footer text-center">
<button type="button" class="btn btn-pink"><i class="fa fa-shopping-cart"></i> View Product </button></div>
</div>
</div>
</div>
You can use flexbox to achieve this add display:flex to parent div and check
check code snippet below using flexbox
.card-main {
display: flex;
}
<div class="card-main">
<div class="col-xs-6 col-sm-3">
<div class="card card-default">
<div class="card-img">
<img src="user_images/<?php echo $row['userPic'] ?>" alt="Card image" class="img-thumbnail" height="100">
</div>
<div class="card-body">
<p class="card-text" style="color:#00873a"><b><?php echo $cartname ?></b></p>
<p class="card-text" style="color:#e81b30"><strike style="color:#aaa">₱<?php echo $orig ?>.00</strike> ₱
<?php echo $cartprice ?>.00</p>
</div>
<div class="card-footer text-center">
<button type="button" class="btn btn-pink"><i class="fa fa-shopping-cart"></i> View Product </button></div>
</div>
</div>
<div class="col-xs-6 col-sm-3">
<div class="card card-default">
<div class="card-img">
<img src="user_images/<?php echo $row['userPic'] ?>" alt="Card image" class="img-thumbnail" height="100">
</div>
<div class="card-body">
<p class="card-text" style="color:#00873a"><b><?php echo $cartname ?></b></p>
<p class="card-text" style="color:#e81b30"><strike style="color:#aaa">₱<?php echo $orig ?>.00</strike> ₱
<?php echo $cartprice ?>.00</p>
</div>
<div class="card-footer text-center">
<button type="button" class="btn btn-pink"><i class="fa fa-shopping-cart"></i> View Product </button></div>
</div>
</div>
<div class="col-xs-6 col-sm-3">
<div class="card card-default">
<div class="card-img">
<img src="user_images/<?php echo $row['userPic'] ?>" alt="Card image" class="img-thumbnail" height="100">
</div>
<div class="card-body">
<p class="card-text" style="color:#00873a"><b><?php echo $cartname ?></b></p>
<p class="card-text" style="color:#e81b30"><strike style="color:#aaa">₱<?php echo $orig ?>.00</strike> ₱
<?php echo $cartprice ?>.00</p>
</div>
<div class="card-footer text-center">
<button type="button" class="btn btn-pink"><i class="fa fa-shopping-cart"></i> View Product </button></div>
</div>
</div>
</div>
Note: please change display:flex to display:block for responsive in media query:

Metro grid style

I'm trying to achieve something like the following page:
https://undsgn.com/uncode/homepages/blog-metro/
I have tried and was able to come as close as this: https://jsfiddle.net/futu7t1c/
But how can I get those 2 small-thumbs at the bottom to move up?
The order is big, small, small, big, small, small
<div id="blog-posts">
<div class="grid big-thumb">
Title
</div>
<div class="grid small-thumb">
Title
</div>
<div class="grid small-thumb">
Title
</div>
<div class="grid big-thumb">
Title
</div>
<div class="grid small-thumb">
Title
</div>
<div class="grid small-thumb">
Title
</div>
</div>
css
#blog-posts {
-moz-column-count: 1;
-webkit-column-count: 1;
column-count: 1;
-moz-column-gap: 0em;
-webkit-column-gap: 0em;
column-gap: 0em;
}
.grid {
background: #eee;
float: left;
position: relative;
color: #fff;
}
.big-thumb {
width: 50%;
height: 600px;
background: #aeaeae;
}
.small-thumb {
width: 25%;
height: 300px;
background: #353535;
}
To replicate that grid, you can make flex rows that have flex children that are also flex columns holding your images.
.flex {
display: flex;
}
.col {
flex-direction: column;
flex: 0 0 50%;
}
img {
max-width: 100%;
vertical-align: top;
}
<div class="flex row">
<div class="flex col">
<div class="big">
<img src="http://1.bp.blogspot.com/-hNC-oT6f-fY/TeXxO26yjvI/AAAAAAAAAOY/qfkOqdKkBi8/s1600/platon-photographer-putin-man-of-the-year-portrait.jpg">
</div>
<div class="flex row">
<div class="small">
<img src="https://i.stack.imgur.com/2C22p.jpg">
</div>
<div class="small">
<img src="https://i.stack.imgur.com/2C22p.jpg">
</div>
</div>
</div>
<div class="flex col">
<div class="flex row">
<div class="small">
<img src="https://i.stack.imgur.com/2C22p.jpg">
</div>
<div class="small">
<img src="https://i.stack.imgur.com/2C22p.jpg">
</div>
</div>
<div class="big">
<img src="http://1.bp.blogspot.com/-hNC-oT6f-fY/TeXxO26yjvI/AAAAAAAAAOY/qfkOqdKkBi8/s1600/platon-photographer-putin-man-of-the-year-portrait.jpg">
</div>
</div>
Well, that's how you'd do it using regular ol' html/css. But since you want to just have a bunch of elements that automatagically lay out like that, use masonry
$('.masonry').masonry({
itemSelector: '.item',
columnWidth: '.small'
});
body {
margin: 0;
}
.item {
float: left;
}
.big {
width: 50%;
}
.small {
width: 25%;
}
img {
width: 100%;
vertical-align: top;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://unpkg.com/masonry-layout#4/dist/masonry.pkgd.min.js"></script>
<div class="masonry">
<div class="item big">
<img src="http://1.bp.blogspot.com/-hNC-oT6f-fY/TeXxO26yjvI/AAAAAAAAAOY/qfkOqdKkBi8/s1600/platon-photographer-putin-man-of-the-year-portrait.jpg">
</div>
<div class="item small">
<img src="https://i.stack.imgur.com/2C22p.jpg">
</div>
<div class="item small">
<img src="https://i.stack.imgur.com/2C22p.jpg">
</div>
<div class="item big">
<img src="http://1.bp.blogspot.com/-hNC-oT6f-fY/TeXxO26yjvI/AAAAAAAAAOY/qfkOqdKkBi8/s1600/platon-photographer-putin-man-of-the-year-portrait.jpg">
</div>
<div class="item small">
<img src="https://i.stack.imgur.com/2C22p.jpg">
</div>
<div class="item small">
<img src="https://i.stack.imgur.com/2C22p.jpg">
</div>
</div>

words need to be more appart from eachother and more in the middle of the screen..

This might seem rather easy to solve, but I couldn't find an answer on stackoverflow nor anywhere on the internet to solve my little problem..
I need these http://prntscr.com/a0y8jm words to be more in the middle of the screen, and I need to be able to put the words more appart from eachother, I first used Padding, but I don't really think that works out so well, and the words aren't responding on padding anymore eighter (because I made the layout different)
anyone got any tips on how to make this work, and if you have some tips for the other parts of my code, those are always welcome too. I am not in programming that long yet, so I could use all the information I can get :)
This is my code,
body, html {
margin-left: 10%;
margin-right: 10%;
padding: 0px;
height: 100%;
font-family: georgia, "Comic Sans MS";
background-color: #f0f0f0;
}
header {
height: 5%;
border-bottom: thick solid grey;
}
.img {
width: 25%;
height: 30%;
background-color:#f0f0f0;
float: left;
}
.antwoord {
float: left;
width: 95%;
height: 25px;
background-color: white;
border-style: solid;
border-color: #000000;
border-width: 4px;
}
.move1 {
}
.move2 {
margin-top: 12.5%
}
.move4 {
margin-top: 19%
}
.move5 {
margin-top: 33.5%
}
.move6 {
margin-top: 20.8%
}
.move7 {
margin-top: 37.5%
}
.word, .word .tekst, .word p {
display: inline;
}
.my-row{
clear: both;
}
.answers .word, .answers .word2{
float: left;
padding: 3px;
width: 100px;
}
footer {
border-top: thick solid grey;
height: 5%;
display : table-row;
vertical-align : bottom;
}
.points {
float: right;
}
.container {
height:100%;
border-collapse:collapse;
display : table;
}
.igen {
font-size: 25px;
font-weight: bold;
}
.sprint {
float: right;
}
.copyright {
position: relative;
bottom: 20px;
left: 65px;
font-size: 10px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Words</title>
<link rel="stylesheet" href="css/style.css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
<script>
</script>
</head>
<body>
<header>
<span class="fa fa-refresh" style="font-size:25px;"></span><span class="igen"> igen</span>
<span class="points"><i class="fa fa-thumbs-o-up" style="font-size:24px"></i>Rigtige: 0 <i class="fa fa-thumbs-o-down" style="font-size:24px"></i>Forkerte: 0</span>
</header>
<div class="container">
<div class="img" id="img1">
<div class="plaatje" id="plaatje1"><center><img src="img/cat.jpg" alt="cat" width="50%;"></div>
<div class="move1"><div class="antwoord" id="antwoord1"></div></div>
</div>
<div class="img" id="img2">
<div class="plaatje" id="plaatje1"><center><img src="img/beak.jpg" alt="beak" width="50%;"></div>
<div class="move2"><div class="antwoord" id="antwoord2"></div></div>
</div>
<div class="img" id="img3">
<div class="plaatje" id="plaatje3"><center><img src="img/spoon.jpg" alt="spoon" width="50%;"></div>
<div class="move3"><div class="antwoord" id="antwoord3"></div></div>
</div>
<div class="img" id="img4">
<div class="plaatje" id="plaatje4"><center><img src="img/milk.jpg" alt="milk" width="50%;"></div>
<div class="move4"><div class="antwoord" id="antwoord4"></div></div>
</div>
<div class="img" id="img5">
<div class="plaatje" id="plaatje5"><center><img src="img/egg.jpg" alt="egg" width="50%;"></div>
<div class="move5"><div class="antwoord" id="antwoord5"></div></div>
</div>
<div class="img" id="img6">
<div class="plaatje" id="plaatje6"><center><img src="img/thee.jpg" alt="tea" width="50%;"></div>
<div class="move6"><div class="antwoord" id="antwoord6"></div></div>
</div>
<div class="img" id="img7">
<div class="plaatje" id="plaatje7"><center><img src="img/meel.jpg" alt="meel" width="50%;"></div>
<div class="move7"><div class="antwoord" id="antwoord7"></div></div>
</div>
<div class="img" id="img8">
<div class="plaatje" id="plaatje8"><center><img src="img/passport.jpg" alt="passport" width="50%;"></div>
<div class="move8"><div class="antwoord" id="antwoord8"></div></div>
</div>
<div class="answers">
<div class="my-row">
<div class="word" id="word1">
<div class="tekst" id="tekst1"> <p>Cat</p> </div>
</div>
<div class="word" id="word2">
<div class="tekst" id="tekst2"> <p>spoon</p> </div>
</div>
<div class="word" id="word3">
<div class="tekst" id="tekst3"> <p>meal</p> </div>
</div>
<div class="word" id="word4">
<div class="tekst" id="tekst4"> <p>passport</p> </div>
</div>
</div>
<div class="my-row">
<div class="word2" id="word5">
<div class="tekst" id="tekst5"> <p>egg</p> </div>
</div>
<div class="word2" id="word6">
<div class="tekst" id="tekst6"> <p>beak</p> </div>
</div>
<div class="word2" id="word7">
<div class="tekst" id="tekst7"> <p>tea</p> </div>
</div>
<div class="word2" id="word8">
<div class="tekst" id="tekst8"> <p>milk</p> </div>
</div>
</div>
</div>
<footer>
<img class="dansk" id="dansk" src="img/dansk2.jpg" alt="dansk" />
<img class="sprint" id="sprint" src="img/sprint2.png" alt="sprint" />
<center><span class="copyright"> ©2013 laerdansk / FC-Sprint² Leerbedrijf bronnen </span></center>
</footer>
</body>
</html>