Add div on html & css next to other div - html

I want to add three divs in the same line, but when I add the second div it's displayed below the first div. I don't know how to fix this problem.
.fisrt-div {
background-color: rgb(65, 65, 65);
width: 25%;
margin-left: 20%;
margin-top: 10%;
border-radius: 10px;
width: 20%;
height: 30%;
cursor: pointer;
}
.second-div {
background-color: rgb(65, 65, 65);
width: 25%;
margin-left: 60%;
float: left;
margin-top: 10%;
border-radius: 10px;
width: 20%;
height: 30%;
cursor: pointer;
}
<div class="first-div">
<img class="img1" src="images/androiddev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttext</b><br><br>
<a style="text-decoration: none; color: turquoise; margin-left: 50%; font-size: 17px;" href="">blahblahblah</a></b>
</p>
</div>
<div class="second-div">
<img class="img2" src="images/webdev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttexttexttexttext</b></p>
<a href="" style="text-decoration: none; color: turquoise; margin-left: 50%; font-size:
17px;">blahblahblah</a>
</div>

You have multiple errors :
Class name .first-div not .fisrt-div .
Property widthis duplicated.
If you want to add div's in the same line, use Display:inline-block. [I prefer to do it with flexbox or grid, read more about this]
I have noticed that you put margin-left: 50%; on a style, I think you want to center it, just put Display:block and text-align:center to the a or span styles.
float: left; is not necessary here.
You put a very long text inside b, that's why I used overflow-wrap: break-word; to break text.
.first-div {
background-color: rgb(65, 65, 65);
width: 25%;
border-radius: 10px;
height: 30%;
cursor: pointer;
display:inline-block;
overflow-wrap: break-word;
}
.second-div {
background-color: rgb(65, 65, 65);
width: 25%;
border-radius: 10px;
height: 30%;
cursor: pointer;
display:inline-block;
overflow-wrap: break-word;
}
<div class="first-div">
<img class="img1" src="images/androiddev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttext</b><br><br>
<a style="text-decoration: none; color: turquoise; text-align:center; font-size: 17px; display: block;" href="">blahblahblah</a></b>
</p>
</div>
<div class="second-div">
<img class="img2" src="images/webdev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttexttexttexttext</b></p>
blahblahblah
</div>

The name of your class is written wrong, on the css file.
.fisrt-div

i dont actually get what you're trying to achieve but i hope this helps you.
i removed the float: left
then added display inline-block in css
.fisrt-div {
background-color: rgb(65, 65, 65);
width: 25%;
margin-top: 10%;
border-radius: 10px;
width: 20%;
height: 30%;
cursor: pointer;
}
.second-div {
background-color: rgb(65, 65, 65);
width: 25%;
margin-top: 10%;
border-radius: 10px;
width: 20%;
height: 30%;
cursor: pointer;
}
.third-div {
background-color: rgb(65, 65, 65);
width: 25%;
margin-top: 10%;
border-radius: 10px;
width: 20%;
height: 30%;
cursor: pointer;
}
.first-div, .second-div, .third-div{
display: inline-block;
}
<div class="first-div">
<img class="img1" src="images/androiddev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttext</b><br><br>
<a style="text-decoration: none; color: turquoise; margin-left: 50%; font-size: 17px;" href="">blahblahblah</a></b>
</p>
</div>
<div class="second-div">
<img class="img2" src="images/webdev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttexttexttexttext</b></p>
<a href="" style="text-decoration: none; color: turquoise; margin-left: 50%; font-size:
17px;">blahblahblah</a>
</div>
<div class="third-div">
<img class="img2" src="images/webdev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttexttexttexttext</b></p>
<a href="" style="text-decoration: none; color: turquoise; margin-left: 50%; font-size:
17px;">blahblahblah</a>
</div>

Make one class for both divs then add the following css
div {
background-color: rgb(65, 65, 65);
margin-left: 20px;
margin-top: 20px;
border-radius: 10px;
width: 210px;
height: 100px;
cursor: pointer;
display: inline-block;
}
If you want the words to wrap use word-wrap: break-word;.
If you want both boxes to be the same width, but don' need them to be the same height, make the height: auto.
If you want the boxes to have the same height but don't care about width, make the width: auto.

<div class="main">
<div class="first-div">
<img class="img1" src="images/androiddev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttext</b><br><br>
<a style="text-decoration: none; color: turquoise; margin-left: 50%; font-size: 17px;" href="">blahblahblah</a>
</p>
</div>
<div class="second-div">
<img class="img2" src="images/webdev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttexttexttexttext</b></p>
<a href="" style="text-decoration: none; color: turquoise; margin-left: 50%; font-size:
17px;">blahblahblah</a>
</div>
.main{
display:flex;
flex-wrap:wrap;
}
.fisrt-div {
background-color: rgb(65, 65, 65);
width: 33.33%;
margin-left: 20%;
margin-top: 10%;
border-radius: 10px;
height: 30%;
cursor: pointer;
}
.second-div {
background-color: rgb(65, 65, 65);
width: 33.33%;
margin-top: 10%;
border-radius: 10px;
height: 30%;
cursor: pointer;
}
<div class="main">
<div class="first-div">
<img class="img1" src="images/androiddev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttext</b><br><br>
<a style="text-decoration: none; color: turquoise; margin-left: 50%; font-size: 17px;" href="">blahblahblah</a>
</p>
</div>
<div class="second-div">
<img class="img2" src="images/webdev.png">
<p style="padding: 5px; color: white;"><b>texttexttexttexttexttexttexttexttexttexttexttexttext</b></p>
<a href="" style="text-decoration: none; color: turquoise; margin-left: 50%; font-size:
17px;">blahblahblah</a>
</div>
<script type="text/javascript">
</script>
<div class="as-console-wrapper"><div class="as-console"></div></div>
</div>

Related

Trying to break a title, but word-break isn't working

I have some panels for recipes which have a photo and a title, but the title is too long and I need it to be that size. But word-break: break-word; isn't working. This is what I mean:
This is my code:
<div class="recipe-container">
<div class="recipe-window">
<img src="https://images.immediate.co.uk/production/volatile/sites/30/2020/08/millionaires-shortbread-52587dd.jpg?quality=90&webp=true&resize=300,272">
<p class="recipe-title">Millionare's Shortbread</p>
</div>
<div class="recipe-window">
<img src="https://images.immediate.co.uk/production/volatile/sites/30/2020/08/recipe-image-legacy-id-559666_11-b53071d.jpg?quality=90&webp=true&resize=300,272">
</div>
</div>
.recipe-container {
margin: 0px;
padding: 10px;
display: inline-flex;
}
.recipe-window {
margin: 10px;
padding: 10px;
border: 1px solid #ffffff;
background-color: #ffffff;
word-break: break-word;
width: auto;
}
.recipe-title {
color: black;
margin-top: 5px;
padding: 0px;
font-size: 40px;
}
How can I fix this?
You need to set the width of .recipe-window to min-content.
.recipe-container {
margin: 0px;
padding: 10px;
display: inline-flex;
}
.recipe-window {
margin: 10px;
padding: 10px;
border: 1px solid #ffffff;
background-color: #ffffff;
word-break: break-word;
width: min-content;
}
.recipe-title {
color: black;
margin: 0;
margin-top: 5px;
font-size: 40px;
}
<div class="recipe-container">
<div class="recipe-window">
<a href="https://www.bbcgoodfood.com/recipes/easy-millionaires-shortbread">
<img src="https://images.immediate.co.uk/production/volatile/sites/30/2020/08/millionaires-shortbread-52587dd.jpg?quality=90&webp=true&resize=300,272" />
</a>
<p class="recipe-title">Millionare's Shortbread</p>
</div>
<div class="recipe-window">
<a href="https://www.bbcgoodfood.com/recipes/classic-white-loaf">
<img src="https://images.immediate.co.uk/production/volatile/sites/30/2020/08/recipe-image-legacy-id-559666_11-b53071d.jpg?quality=90&webp=true&resize=300,272" />
</a>
</div>
</div>
.recipe-container {
margin: 0px;
padding: 10px;
display: inline-flex;
flex-wrap: wrap;
}
.recipe-window {
margin: 10px;
padding: 10px;
border: 1px solid #ffffff;
background-color: #ffffff;
width: 300px;
}
.recipe-title {
color: black;
margin-top: 5px;
padding: 0px;
font-size: 40px;
}
<div class="recipe-container">
<div class="recipe-window">
<a href="https://www.bbcgoodfood.com/recipes/easy-millionaires-shortbread">
<img
src="https://images.immediate.co.uk/production/volatile/sites/30/2020/08/millionaires-shortbread-52587dd.jpg?quality=90&webp=true&resize=300,272">
</a>
<p class="recipe-title">Millionare's Shortbread</p>
</div>
<div class="recipe-window">
<a href="https://www.bbcgoodfood.com/recipes/classic-white-loaf">
<img
src="https://images.immediate.co.uk/production/volatile/sites/30/2020/08/recipe-image-legacy-id-559666_11-b53071d.jpg?quality=90&webp=true&resize=300,272">
</a>
</div>
</div>

Put 2 buttons div on my banner and center

I would like to put 2 buttons div (register and login) on my banner and center. However I think that I already have a problem with my blocks on my html ??
Here is an overview of my website in below.
screenshot:
My first problem is that I don't can to use the margin-left or margin-right to move my button "register" or "login" for center.
My problem comes perhaps from code HTML, Is it a problem with my blocks ?
Here is my code HTML
<div class="my-banner">
<img class="banner" src="images/slider.jpg"/>
<div class="transparent"></div>
<img class="picture-logo" src="images/logo.png"/>
<div class="container">
<div class="myButtonRegister">REGISTER</div>
<div class="myButtonLogin">LOGIN</div>
<div class="topnav">
<a class="active" href="index.php">HOME</a>
ABOUT US
INVESTEMENT PLAN
NEWS
FAQS
RULES
CONTACT US
</div>
</div>
</div>
Here is my code CSS
.myButtonRegister{
margin-top: 342px;
float: left;
background-color: #C22312;
color: white;
height: 48px;
width: 168px;
text-align: center;
color: white;
font-family: 'Pridi', serif;
font-size: 26px;
padding-top: 10px;
word-spacing: 0px;
}
.myButtonRegister a {
color: #f2f2f2;
text-decoration: none;
}
.myButtonLogin{
margin-top: 342px;
float: left;
background-color: black;
color: white;
height: 48px;
width: 168px;
text-align: center;
color: white;
font-family: 'Pridi', serif;
font-size: 26px;
padding-top: 10px;
word-spacing: 0px;
}
Do you have an idea plase ?
Just add a father box to your buttons and use flex to align your buttons. Here is an example:
.container {
height: 200px;
width: 100%;
background: #eee;
}
.container .subcontainer {
display: flex;
height: 100%;
align-items: center;
justify-content: center;
}
<div class="container">
<div class="subcontainer">
<button>Login</button>
<button>Register</button>
</div>
<!--NAV-->
</div>
Try following code for good design and set maximum height & width image in banner no issues create for this type of design this is the right way.
.myButtonRegister{
float: left;
background-color: #C22312;
color: white;
height: 48px;
width: 168px;
text-align: center;
color: white;
font-family: 'Pridi', serif;
font-size: 26px;
padding-top: 10px;
word-spacing: 0px;
}
.myButtonRegister a {
color: #f2f2f2;
text-decoration: none;
}
.myButtonLogin{
float: left;
background-color: black;
color: white;
height: 48px;
width: 168px;
text-align: center;
color: white;
font-family: 'Pridi', serif;
font-size: 26px;
padding-top: 10px;
word-spacing: 0px;
}
.button-action {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
-webkit-transform: translate(-50%,-50%);
-moz-transform: translate(-50%,-50%);
-ms-transform: translate(-50%,-50%);
}
<div class="my-banner">
<div class="banner-image">
<img class="banner" src="images/slider.jpg"/>
<div class="button-action">
<div class="myButtonRegister">REGISTER</div>
<div class="myButtonLogin">LOGIN</div>
</div>
</div>
<div class="transparent"></div>
<img class="picture-logo" src="images/logo.png"/>
<div class="container">
<div class="topnav">
<a class="active" href="index.php">HOME</a>
ABOUT US
INVESTEMENT PLAN
NEWS
FAQS
RULES
CONTACT US
</div>
</div>
</div>
Using position:absolute remove margin-top and give parent div to height and position:relative
.my-banner{
position:relative;
height: 450px;
}
.btnBox{
position: absolute;
left: 0px;
right: 0px;
top: 0px;
margin: auto;
bottom: 0px;
height: 85px;
width: 336px;
}
.myButtonRegister{
float: left;
background-color: #C22312;
color: white;
height: 48px;
width: 168px;
text-align: center;
color: white;
font-family: 'Pridi', serif;
font-size: 26px;
padding-top: 10px;
word-spacing: 0px;
}
.myButtonRegister a {
color: #f2f2f2;
text-decoration: none;
}
.myButtonLogin{
float: left;
background-color: black;
color: white;
height: 48px;
width: 168px;
text-align: center;
color: white;
font-family: 'Pridi', serif;
font-size: 26px;
padding-top: 10px;
word-spacing: 0px;
}
<div class="my-banner">
<img class="banner" src="images/slider.jpg"/>
<div class="transparent"></div>
<img class="picture-logo" src="images/logo.png"/>
<div class="container">
<div class="btnBox">
<div class="myButtonRegister">REGISTER</div>
<div class="myButtonLogin">LOGIN</div>
</div>
<div class="topnav">
<a class="active" href="index.php">HOME</a>
ABOUT US
INVESTEMENT PLAN
NEWS
FAQS
RULES
CONTACT US
</div>
</div>
</div>

External CSS files causing problems to images

This is NetBeans. I have tried to include an external CSS file but when used externally the images all get really enlarged. Whereas my I use the same styling within the html file using internal styling the images are of correct ratio.
body {
width: 100%;
height: 100%;
margin: 0;
}
.header {
background-color: #000;
color: #fff;
border-color: #080808;
min-height: 50px;
border: 1px solid transparent;
}
.inner header {
width: 80%;
margin: auto;
}
.logo {
float: left;
height: 50px;
padding: 15px;
font-size: 20px;
font-weight: bold;
padding-left: 90px;
}
a {
text-decoration: none;
background-color: transparent;
color: #ededed;
}
.header link {
float: right;
font-size: 14px;
height: 50px;
padding: 15px 15px;
font-size: 16px;
font-weight: bold;
}
#su {
float: right;
height: 50px;
padding: 15px 90px;
}
#l {
float: right;
height: 50px;
padding: 15px 0px;
}
.content {
min-height: 600px;
}
.banner-image {
padding-bottom: 50px;
margin-bottom: 20px;
text-align: center;
color: #f8f8f8;
background: url(image/intro-bg_1.jpg) no-repeat center;
background-size: cover;
}
.inner-banner-image {
padding-top: 12%;
width: 80%;
margin: auto;
}
.banner-content {
position: relative;
padding-top: 6%;
padding-bottom: 6%;
overflow: hidden;
margin-bottom: 12%;
background-color: rgba(0, 0, 0, 0.7);
max-width: 660px;
margin-left: 200px;
}
.button {
color: #fff;
background-color: #c9302c;
border-color: #ac2925;
box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);
padding: 10px 16px;
font-size: 18px;
border-radius: 6px;
}
.container {
width: 90%;
margin: auto;
overflow: hidden;
}
.items {
width: 30%;
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
float: left;
margin-left: 1%;
}
.thumbnail {
display: block;
max-width: 100%;
height: auto;
}
.caption {
color: #000;
padding: 0px 10px 10px;
font-weight: bold;
text-align: center;
}
footer {
background-color: #000;
color: #fff;
font-size: 14px;
text-align: center;
}
<html>
<head>
<title>Lifestyle Store</title>
</head>
<body>
<div class="header">
<div class="inner header">
<div class="logo">
Lifestyle Store
</div>
<div class="header link">
<div id="su">
Sign Up
</div>
<div id="l">
Login
</div>
</div>
</div>
</div>
<div class="content">
<div class="banner-image">
<div class="inner-banner-image ">
<div class="banner-content">
<h1>We sell lifestyle</h1>
<p>Flat 40% OFF on premium brands</p>
<form>
Shop Now
</form>
</div>
</div>
</div>
</div>
<div class="container">
<div class="items">
<a href="#">
<img src="image/camera.jpg" class="thumbnail">
<div class="caption">
<h2>Cameras</h2>
<p>Choose among the best from the world</p>
</div>
</a>
</div>
<div class="items">
<a href="#">
<img src="image/watch.jpg" class="thumbnail">
<div class="caption">
<h2>Watches</h2>
<p>Original watches from the best brands</p>
</div>
</a>
</div>
<div class="items">
<a href="#">
<img src="image/shirt.jpg" class="thumbnail">
<div class="caption">
<h2>Shirts</h2>
<p>Our exquisite collection of shirts</p>
</div>
</a>
</div>
</div>
<footer>
<div class="container">
<p>Copyright © Lifestyle Store. All Rights Reserved | Contact Us: +91 90000 00000</p>
</div>
</footer>
</body>
</html>
Have you linked the CSS file correctly in this line? Try dragging and dropping the file directly into the HTML to ensure the location and name is correct.
href="assignment1/public_html/style.css"
Edit:
The current link you have is saying that you have the index.html file outside of the 'assignment1' folder. If you have your HTML file inside 'public_html' then the stylesheet link should be the following.
href="style.css"

How to place p tag under image?

So i'm trying to place some text under an image but for some reason it stays on the right till the container ends and then goes under the image.
I want it to be fully under the image.
And here is the code:
.post {
margin-top: 3px;
width: 80%;
font-size: 20px;
border-bottom: 1px solid #ddd;
}
.post h2 {
font-size: 20px;
cursor: pointer;
}
.post h2:hover {
color: #0099FF;
}
.post img {
display: block;
width: 95%;
height: auto;
float: left;
position: relative;
}
.post p {
display: block;
top: 7px;
font-size: 13px;
color: #999;
}
.rating {
display: inline-block;
}
.rate {
display: inline-block;
height: 34px;
width: 44px;
border: 1px solid #ddd;
border-radius: 3px;
text-align: center;
cursor: pointer;
line-height: 30px;
margin-bottom: 25px;
margin-left: 5px;
}
.rate:first-child {
margin-left: 0;
}
.rate:hover {
border: 1px solid #999;
}
.rate img {
position: relative;
top: 7px;
left: 12px;
width: 20px;
height: 20px;
}
.social {
display: inline-block;
height: 34px;
float: right;
}
.social a img {
display: inline-block;
height: 34px;
width: auto;
margin-right: 10px;
}
<div class="post">
<h2>I know I'm a douche for wearing sunglasses at night but...</h2>
<img src="http://img-9gag-fun.9cache.com/photo/a77Pzr2_700b.jpg" />
<div class="postfooter">
<p>Over 9000 points · 56 comments</p>
<div class="rating">
<div class="rate">
<img src="up.png">
</div>
<div class="rate">
<img src="down.png">
</div>
<div class="rate">
<img src="comment.png">
</div>
</div>
<div class="social">
<a href="#">
<img src="facebook.png">
</a>
<a href="#">
<img src="twitter.png">
</a>
<a href="#">
<img src="googleplus.png">
</a>
</div>
</div>
Also it looks alright in chrome for some reason and not alright in FF.
Add css for .postfooter
.postfooter {
clear: both;
}
This will ensure it's on its own line.

Aligning four squares div inside a container div

I want to vertical align four single divs side by side. Each div contains text + image.
For some reason, it's not working. There are some divs which located more higher than the others.
I want it to look like that:
div's container:
DIV DIV DIV DIV
<div id="skills-container" class="full-size-properties">
<h1 class="site-titles">Personal Skills</h1>
<div id="four-rectangles">
<div id="front-end" class="single-skills-rectangle">
<img src="Images/front-end.png" />
<h1>FRONT-END</h1>
<h2>CSS3, HTML5, JavaScript</h2>
</div>
<div id="back-end" class="single-skills-rectangle">
<img src="Images/back-end.png" />
<h1>BACK-END</h1>
<h2>JAVA</h2>
</div>
<div id="design" class="single-skills-rectangle">
<img src="Images/design.png" />
<h1>DESIGN</h1>
<h2>?</h2>
</div>
<div id="photography" class="single-skills-rectangle">
<img src="Images/photography.png" />
<h1>PHOTOGRAPHY</h1>
<h2>Canon and Nikon</h2>
</div>
</div>
</div>
Here is the CSS:
#skills-container {
height: 400px;
background: #F8F8F8 url("../Images/noisy.png");
top: 5px;
}
#four-rectangles {
position: absolute;
top: 60px;
background-color: yellow;
}
.single-skills-rectangle {
background-color: #fff;
width: 200px;
height: 210px;
border: 1px solid #CBCBCB;
border-radius: 10px;
display: inline-block;
margin-left: 25px;
text-align: center;
}
.single-skills-rectangle h1 {
font-size: 20px;
font-weight: 700;
color: #06557c;
margin-top: 35px;
}
.single-skills-rectangle img {
margin-top: 30px;
}
.single-skills-rectangle h2 {
font-size: 15px;
color: #808080;
margin-top: 7px;
}
Just add vertical-align: top to the .single-skills-rectangle class.
body {
margin: 0;
}
#skills-container {
height: 400px;
background: #F8F8F8 url("../Images/noisy.png");
top: 5px;
}
#four-rectangles {
position: absolute;
top: 60px;
background-color: yellow;
}
.single-skills-rectangle {
background-color: #fff;
width: 120px;
height: 210px;
border: 1px solid #CBCBCB;
border-radius: 10px;
display: inline-block;
margin-left: 15px;
text-align: center;
vertical-align: top;
}
.single-skills-rectangle h1 {
font-size: 14px;
font-weight: 700;
color: #06557c;
margin-top: 35px;
}
.single-skills-rectangle img {
margin-top: 30px;
}
.single-skills-rectangle h2 {
font-size: 12px;
color: #808080;
margin-top: 7px;
}
<div id="skills-container" class="full-size-properties">
<h1 class="site-titles">Personal Skills</h1>
<div id="four-rectangles">
<div id="front-end" class="single-skills-rectangle">
<img src="http://lorempixel.com/70/70/city" />
<h1>FRONT-END</h1>
<h2>CSS3, HTML5, JavaScript</h2>
</div>
<div id="back-end" class="single-skills-rectangle">
<img src="http://lorempixel.com/80/80/city" />
<h1>BACK-END</h1>
<h2>JAVA</h2>
</div>
<div id="design" class="single-skills-rectangle">
<img src="http://lorempixel.com/60/60/city" />
<h1>DESIGN</h1>
<h2>?</h2>
</div>
<div id="photography" class="single-skills-rectangle">
<img src="http://lorempixel.com/50/50/city" />
<h1>PHOTOGRAPHY</h1>
<h2>Canon and Nikon</h2>
</div>
</div>
</div>
One solution is to use a default width for all your images regardless of the size of each image:
.single-skills-rectangle img {
width: 100px;
}
Code snippet
#skills-container {
height: 400px;
background: #F8F8F8 url("../Images/noisy.png");
top: 5px;
}
#four-rectangles {
position: absolute;
top: 60px;
background-color: yellow;
}
.single-skills-rectangle {
background-color: #fff;
width: 200px;
height: 210px;
border: 1px solid #CBCBCB;
border-radius: 10px;
display: inline-block;
margin-left: 25px;
text-align: center;
}
.single-skills-rectangle h1 {
font-size: 20px;
font-weight: 700;
color: #06557c;
margin-top: 35px;
}
.single-skills-rectangle img {
margin-top: 30px;
}
.single-skills-rectangle h2 {
font-size: 15px;
color: #808080;
margin-top: 7px;
}
.single-skills-rectangle img {
width: 100px;/*add a default image width*/
}
<div id="skills-container" class="full-size-properties">
<h1 class="site-titles">Personal Skills</h1>
<div id="four-rectangles">
<div id="front-end" class="single-skills-rectangle">
<img src="http://upload.wikimedia.org/wikipedia/commons/9/96/Google_web_search.png" />
<h1>FRONT-END</h1>
<h2>CSS3, HTML5, JavaScript</h2>
</div>
<div id="back-end" class="single-skills-rectangle">
<img src="http://upload.wikimedia.org/wikipedia/commons/9/96/Google_web_search.png" />
<h1>BACK-END</h1>
<h2>JAVA</h2>
</div>
<div id="design" class="single-skills-rectangle">
<img src="http://upload.wikimedia.org/wikipedia/commons/9/96/Google_web_search.png" />
<h1>DESIGN</h1>
<h2>?</h2>
</div>
<div id="photography" class="single-skills-rectangle">
<img src="http://upload.wikimedia.org/wikipedia/commons/9/96/Google_web_search.png" />
<h1>PHOTOGRAPHY</h1>
<h2>Canon and Nikon</h2>
</div>
</div>
</div>