Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!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" />
    <meta name="description" content="This is a microsite created for the school, the theme being a subject from Space X or NASA and using their API.">
    <meta name="keywords" content="curiosity rover, space x , nasa, rocket, marte, red planet">
    <meta name="author" content="Florinda Zeida">
    <title>Home | Welcome</title>
    <!--CSS============================================= -->

    <link rel="stylesheet" href="styleshet.css">
    <link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,300;0,400;0,700;1,700&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;0,500;0,700;0,900;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,400;0,500;0,600;0,700;0,800;1,300&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Sacramento&display=swap" rel="stylesheet">
    <!--CSS============================================= -->
    <!--ICON SOSIAL MEDIA============================================= -->
    <script src="https://kit.fontawesome.com/aa9fac59e8.js" crossorigin="anonymous"></script>
</head>

<body>
    <div class="preloader">
        <img class="loading" src="/images/loading.png">
    </div>

    
   
    

      
    </div>
    <div class="bannerData2">

    </div>
    <main class="contentRowData">


        <div class="bannerData">

        </div>

        <div class="introSectionContent">



            <div class="introSectionText">
                <h4>raw images taken by NASA's </h4>
                <h2> Curiosity Mars Rover</h2>

                <p>NASA has begun using a new system to process the raw data generated by its Curiosity rover on Mars. The Mission Data Processing and Control System (MPCS) presents data visually so that it's useful to a wider range of project team members,
                    including mission managers, software developers, and scientists. For the past week, Curiosity has been parked in the same spot on Mars as NASA tests the rover's robotic arm in preparation for using its instruments to "touch" rocks
                    for the first time. The space agency plans to resume driving the rover within the next few days, generating new kinds of data, such as the composition of rocks, to be transmitted back to mission headquarters at NASA's Jet Propulsion
                    Laboratory in California.<a href="https://www.informationweek.com/software/information-management/nasa-makes-most-of-curiosity-rover-data/d/d-id/1106298?">Read the Full story</a></p>
            </div>


        </div>

        <div class="galleryPictures">
            <div class="card">
                <div class="cardContent"></div>
            </div>
        </div>


    </main>



   
</body>

</html>
              
            
!

CSS

              
                .galleryPictures {
    max-width: 1360px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
    background-image: url("/images/back1.jpg");
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-position: cover;
    background-size: 1400px 100%;
}

.card {
    max-width: 300px;
    display: flex;
    text-align: center;
    justify-content: center;
    margin: 10px;
}

.cardContent {
    max-width: 300px;
    text-align: center;
    justify-content: center;
    padding: 10px;
    background-color: #2B181A;
    box-shadow: 5px 5px 15px #184975;
    font-family: roboto;
    border-radius: 10px;
    transition: 0.5s ease;
    cursor: pointer;
    margin: 10px;
    color: #fbdbcb;
}

.imageRowData {
    display: block;
    width: 280px;
    height: 220px;
}

.details {
    display: none;
}

.status {
    color: #ff5955;
}

.cardH2 {
    margin-top: 10px;
    font-size: 18px;
}

.cardH3 {
    text-align: left;
    margin-left: 15px;
    font-size: 16px;
}

.card b {
    margin-left: 3px;
}

#cardBtn {
    background-color: #ff5955;
    border: none;
    color: white;
    padding: 10px 40px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    outline: none;
    margin: 20px auto;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.6);
}


              
            
!

JS

              
                const urlCuriosity = "https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?sol=1000&api_key=OHEbI7rTkhvwIuzGPAUuwvezPdwKXaxcbU0CDoSI";


async function getCuriosityUrl() {
    try {
        const response = await fetch(urlCuriosity);
        const jsonResult = await response.json();
        displayRowData(jsonResult.photos);
    } catch (error) {
        console.log(error + "Something is wrong");
    } finally {
        const load = document.querySelector(".loading");
        load.style.display = "none";
        console.log("evrything is done!");
    }
}

getCuriosityUrl();

function displayRowData(images) {
    const gallery = document.querySelector(".galleryPictures");
    let html = "";
    for (let i = 0; i < images.length; i++) {
        console.log("html", html);
        if (i === 12) {
            break;

        }
        html += `<div class="galleryPictures">
                    <div class="card">
                    <div class="cardContent">
                        <img class="imageRowData" src="${images[i].img_src}" alt=""/>
                        <div class="details">
                        <span id="readMore"></span> 
                            <h4 class="status">Status:<b> ${images[i].rover.status}</b></h4>  
                        <h2 class="cardH2">${images[i].camera.full_name}</h2>
                            <h3 class="cardH3">Rover name:<b> ${images[i].rover.name}</b></h3>
                            <h3 class="cardH3">Launch date:<b> ${images[i].rover.launch_date}</b></h3>
                            <h3 class="cardH3">Landing date:<b> ${images[i].rover.landing_date}</b></h3>          
                        </div>  
                        <button onclick="cardFunction()" id="cardBtn">View info</button>
                    </div>
                    </div>
                </div>`;
    }
    gallery.innerHTML = html;
}

function cardFunction() {
    const readMore = document.querySelector("#readMore");
    const moreText = document.querySelector(".details");
    const cardBtn = document.querySelector("#cardBtn");

    if (readMore.style.display === "none") {
        readMore.style.display = "inline";
        cardBtn.innerHTML = "View info";
        moreText.style.display = "none";
    } else {
        readMore.style.display = "none";
        cardBtn.innerHTML = "Close";
        moreText.style.display = "inline";
    }
}
              
            
!
999px

Console