How to properly insert a landing page within same container beneath an image element?

Joined
Oct 6, 2024
Messages
3
Reaction score
0
hi everyone I am new here and a beginner in HTML programming. I am trying to make my web page look like my design from Canva below.
optima seas green investment.jpg

However the second image beneath t is what I got, it's almost there but both my image and landing page are beneath the text instead of being on the right side of the screen even though they are within different container divs , how do fix this?
Screenshot 2024-10-07 112320.png

Screenshot 2024-10-07 112335.png




below is my specific HTML for this particular design

HTML:
<body>
        <div class="green-investment-title">
            <h1>Green Investment</h1>
          </div>
          <div class="green-content">
            <div class="green-text">
              <h2>Profit from the green revolution</h2>
              <p>
                Reduce your carbon foot print and make a positive impact on the
                environment and the community by investing in clean and green energy.
                Bali offers untaped green investment potential as the booming tourism
                industry draws an international crowd of environmentally conscious
                people to the island who not only want to livre a healthy lifestyle
                being close to nature but also perserve it
              </p>
              <p>
                Despite the vast potential of being an ecohub the island’s
                consciousness towards the environment is poorly managed due to a
                mentality of unhygienic lifestyle especially relating to waste
                disposal. Passed down from generations, the people of Bali are taught
                that everything used in their daily life are easily disposed of by
                dumping them out in nature and in public places. This sort of
                mentality exists because their ancestors haver grown accustomed to
                using everyday items made from natural materialks like wood and plant
                fiber. However times have changed as people use everyday items that
                are synthetically made that damage nature. Unfortunately the Balinese
                have not caught up to this change as they are still stuck with the
                outdated mindset of their ancestors.
              </p>
              <p>
                This is where you, the investor come in. You can invest in building
                green businesses like solar farms, recycling plant, public parks and
                green spaces to instill a mentality of care for motherr nature. By
                doing this you will improve the island’s green image and gain more
                clients in thed process. To get updates on new green investments in
                Bali and other islands indoinesia, subscribe to our newsletter on the bottom of the
                image onm the right.
              </p>
              
            <div class="green-image-container">
              <img class="cropped-image" src="file:///C:/xampp/htdocs/templatemo_591_villa_agency/assets/images/solar%20cells.jpg" />
            </div>
            <div class="green-newsletter-apply">
              <form id="green-form"> 
                <label>
                  First Name
                  <input name="first_name"   type="text" required>
                </label>
                <label>
                  Last Name
                  <input name="last_name"      type="text" required>
                </label>
                <label>
                  Email
                  <input name="email"    type="text" required>
                </label>
                <button> register </button>
            </div>
          </div>
          </div>
    </body>

below is the specific CSS
CSS:
.green-investment-title {
    width: 100%;
    height: 70px;
    background-color: #56aeff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
  }
 

  .green-content {
    display: flex;
    flex-direction: row;
    gap: 20px;
    background-image: none;
    padding: 80px 0 80px 80px;
  }
 

  .green-text {
    width: 50%;
    font-size: 20px;
    font-family: Arial;
  }

  .green-newsletter-apply {
    height: 300px;
    width: 450px;
    background-color: #E6C536;
  }
 

  .green-image-container {
    width: 50%;
    height: auto;
    overflow: hidden;
    position: relative;
  }

  .cropped-image {
    width: 100%;
    height: auto;
    clip-path: polygon(30% 0, 100% 0, 100% 100%, 0 100%, 0 100%);
  }

if you want to view the full code layout it is on my js fiddle : https://jsfiddle.net/schmueller23/zcagurqy/3/

how do I fix my errors? thank you
 
Joined
Jul 4, 2023
Messages
570
Reaction score
76
Try using a grid to set up your site's layout as you wish.
HTML:
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Green Investment</title>

    <style>
      html, body {
        margin: 0;
        padding: 0;
        font-family: Arial, sans-serif;
      }
      body {
        display: grid;
        grid-template-columns: minmax(auto, 1.5fr) minmax(100px, 1fr);
        grid-template-rows: auto auto 1fr;
        gap: 0;
        grid-template-areas:
          "header header"
          "main image"
          "main form";
        background-image: url('https://clipart-library.com/new_gallery/318-3187684_blue-absctract-background-png-illustration.png');
        background-size: cover;
        background-position: center;
      }
      header {
        grid-area: header;
        background-color: hsla(208, 80%, 50%, 0.9);
        color: white;
        text-align: center;
        max-height: 70px;
      }
      main {
        grid-area: main;
        background-color: transparent;
        color: black;
        padding: 1.5rem;
        font-size: 1rem;
        line-height: 1.3;
      }
      aside.image {
        grid-area: image;
        background-color: transparent;
        margin-top: 2rem;
      }
      aside.image img {
        display: block;
        width: 95%;
        height: auto;
        object-fit: cover;
      }
      aside.form {
        grid-area: form;
        background-color: transparent;
        margin-top: 10dvh;
        padding: 2rem;
        text-align: center;
      }
      aside.form h3 {
        color: hsl(177, 46%, 54%);
      }
      .form-container {
        display: flex;
        flex-direction: column;
        width: max(180px, 20dvw);
        gap: 1rem;
        background-color: hsl(49, 74%, 55%);
        padding: 1rem;
        margin: 0 auto;
      }
      .form-container input {
        padding: .25rem;
        font-size: 1rem;
        border: 1px solid hsl(0, 0%, 75%);
        border-radius: .25rem;
      }
      .form-container input::placeholder {
        padding: .25rem .5rem;
        font-size: 85%;
      }
      .form-container button {
        padding: .5rem;
        font-size: 1rem;
        font-weight: bold;
        background-color: hsl(177, 46%, 54%);
        color: black;
        border: none;
        border-radius: 0.5rem;
        cursor: pointer;
        transition: background-color 150ms;
      }
      .form-container button:hover {
        background-color: hsl(177, 46%, 44%);
      }

      @media (max-width: 680px) {
        body {
          grid-template-columns: 1fr;
          grid-template-rows: auto auto auto auto;
          grid-template-areas:
            "header"
            "image"
            "main"
            "form";
        }
      }
    </style>
  </head>
  <body>
    <header>
      <h1>Green Investment</h1>
    </header>
    <main>
      <h2>Profit from the green revolution</h2>
      <p>
        Reduce your carbon foot print and make a positive impact on the
        environment and the community by investing in clean and green energy.
        Bali offers untaped green investment potential as the booming tourism
        industry draws an international crowd of environmentally conscious
        people to the island who not only want to livre a healthy lifestyle
        being close to nature but also perserve it.
      </p>
      <p>
        Despite the vast potential of being an ecohub the island’s
        consciousness towards the environment is poorly managed due to a
        mentality of unhygienic lifestyle especially relating to waste
        disposal. Passed down from generations, the people of Bali are taught
        that everything used in their daily life are easily disposed of by
        dumping them out in nature and in public places. This sort of
        mentality exists because their ancestors haver grown accustomed to
        using everyday items made from natural materialks like wood and plant
        fiber. However times have changed as people use everyday items that
        are synthetically made that damage nature. Unfortunately the Balinese
        have not caught up to this change as they are still stuck with the
        outdated mindset of their ancestors.
      </p>
      <p>
        This is where you, the investor come in. You can invest in building
        green businesses like solar farms, recycling plant, public parks and
        green spaces to instill a mentality of care for motherr nature. By
        doing this you will improve the island’s green image and gain more
        clients in thed process. To get updates on new green investments in
        Bali and other islands indoinesia, subscribe to our newsletter on the bottom of the
        image onm the right.
      </p>
      <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.
      </p>
      <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.
      </p>
      <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.
      </p>
      <p>
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.
      </p>
    </main>

    <aside class="image">
      <img src="https://pngimg.com/uploads/solar_panel/solar_panel_PNG96.png" alt="Solar Panels">
    </aside>

    <aside class="form">
      <h3>Apply for our newsletter</h3>
      <div class="form-container">   
        <input type="text" placeholder="First Name">
        <input type="text" placeholder="Last Name">
        <input type="email" placeholder="Email">
        <button>Apply</button>
      </div>
    </aside>
  </body>
</html>
1731874807840.png


1731874670452.png
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,170
Messages
2,570,925
Members
47,466
Latest member
DrusillaYa

Latest Threads

Top