Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Transitions and Transforms Adding 3D Effects with CSS Build a Rotating 3D Cube

Daniel Sarmiento
Daniel Sarmiento
10,265 Points

I just preview my workspace and saw that the imgs are outside the cube and really big. Is it suppose to be like that?

This is the workspace preview

http://imgur.com/dKiqPpn

And this is how it's displayed at the beggining of the video

http://imgur.com/a/cp228

This is the index.html

<!DOCTYPE html>
<html>
<head>
    <title>3D Transform Gallery</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/interactions.css">
</head>
<body>
    <div class="container">
        <header class="main-header clearfix">
            <img class="logo" src="img/camera.svg">
            <h1 class="name">3DTransform <span>Gallery</span></h1>
        </header>

        <div class="content clearfix">

            <div class="cube-container">
                <div class="photo-cube">

                    <img class="front"src="img/photos/1.jpg" alt="">
                    <div class="back photo-desc">
                      <h3>Earth from Space</h3>
                      <p>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
                        <a href="#" class="button">download</a>
                    </div>
                    <img class="left" src="img/photos/2.jpg" alt="">
                    <img class="right" src="img/photos/3.jpg" alt="">

                </div>
            </div>  

            <div class="cube-container">
                <div class="photo-cube">

                    <img class="front"src="img/photos/4.jpg" alt="">
                    <div class="back photo-desc">
                      <h3>Space Images</h3>
                      <p>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
                        <a href="#" class="button">download</a>
                    </div>
                    <img class="left" src="img/photos/5.jpg" alt="">
                    <img class="right" src="img/photos/6.jpg" alt="">

                </div>
            </div>  

            <div class="cube-container">
                <div class="photo-cube">

                    <img class="front"src="img/photos/7.jpg" alt="">
                    <div class="back photo-desc">
                      <h3>The Milky Way</h3>
                      <p>Aenean lacinia bibendum nulla sed consectetur. Fusce dapibus, tellus ac cursus commodo.</p>
                        <a href="#" class="button">download</a>
                    </div>
                    <img class="left" src="img/photos/8.jpg" alt="">
                    <img class="right" src="img/photos/9.jpg" alt="">

                </div>
            </div>  

        </div>
    </div>
</body>
</html>

This in the main.css

/* ================================= 
  Base Element Styles
==================================== */

* {
    box-sizing: border-box;
}
body {
    font: 1em/1.5 'Open Sans', sans-serif;
    color: #373737;
    background: #eaeaea;
    margin: 0;
}
a {
    text-decoration: none;
}
h1,
h2,
h3 {
    text-transform: uppercase;
}
h2 {
    font-size: 1.125em;
    color: #4a89ca;
    font-weight: 600;
    margin: 0;
}
h3 {
    font-size: 1.3em;
    line-height: 1.25em;
    margin-top: .85em;
    margin-bottom: .5em;
}
p {
    font-size: .875em;
    line-height: 1.4;
    margin: 0 0 1.5em;
}

/* ================================= 
  Base Layout Styles
==================================== */

/* ---- Layout Containers ---- */

.container,
.content {
    margin: auto;
}
.container {
    width: 94.02985075%;
    max-width: 1260px;
    padding: 0 2.25em 4em;
    background: #fff;
}
.main-header {
    text-align: center;
    padding: 2.8em 0 3.8em;
}
.cube-container {
    max-width: 200px;
    text-align: center;
    margin: 0 auto 4.5em;
}
/* ---- Page Elements ---- */

.name {
    font-size: 1.65em;
    font-weight: 800;
    margin: 0 0 1.5em;
    line-height: 1;
}
.name span {
    font-weight: 300;
    margin-left: -7px;
}
.logo {
    width: 45px;
    margin-bottom: .4em;
    cursor: pointer;
}
.button {
    font-size: .8em;
    color: #fff;
    width: 90%;
    line-height: 1.15;
    font-weight: 700;
    display: block;
    text-decoration: none;
    text-transform: uppercase;
    padding: .95em 0;
    border-radius: .5em;
    background: rgba(74,137,202, .8);
    margin: auto;
}
/* ---- Photo Overlay ---- */

.photo-desc {
    font-size: .85em;
    color: #fff;
    padding: 1.1em 1em 0;
    background: #345d88;
}
/* ---- Float clearfix ---- */

.clearfix::after {
    content: " ";
    display: table;
    clear: both;
}

/* ================================= 
  Media Queries
==================================== */

@media (min-width: 769px) {
    .cube-container {
        float: left;
        margin-left: 16.6%;
    }
}
@media (min-width: 1025px) {
    .cube-container:first-child {
        margin-left: 0;
    }
    .cube-container:last-child{
        float: right;
    }
    .content {
        max-width: 900px;
        margin: auto;
    }
}

And this is interactions.css

/* =================================
  Button Transitions
==================================== */

.button {
    transition: background .3s;
}
.button:hover {
    background: rgba(74,137,202, 1);
}

/* =================================
  Photo 3D Transforms & Transitions
==================================== */

.cube-container {
    box-shadow: 0 18px 40px 5px rgba(0,0,0,.4);
    perspective: 800px;
}

.photo-cube {
    transition: transform 2s ease-in-out;
    width: 220px;
    height: 200px;
    transform-style: preserve-3d;
}

.photo-cube:hover {
    transform: rotateY(-270deg);
}
Steven Parker
Steven Parker
231,236 Points

For an issue like this, we might need access to the images as well as the code to a complete analysis. You can make a code snapshot (not a photo) of your workspace and post the link to it here.

1 Answer

Yes it's supposed to be like that when you first launch the workspace. This is because there are no styles for the images originally. This is because we style the images a few minutes into the video.