What are the steps to achieve such a design?

Can you show me how to create a single layout using HTML and CSS?

I am struggling with splitting the screen properly. Could you provide a simple example, maybe on jsfiddle?

https://i.stack.imgur.com/d2rbn.jpg

Thank you in advance!

EDIT:

I have added an example. Please feel free to make any modifications or suggest alternative solutions. It is crucial that the two bottom divs always maintain a square shape.

https://jsfiddle.net/L3ttfL72/

Answer №1

When dealing with square divs, ensure they have equal height and width. If you want the size of square divs to be a percentage of the window's width, use vh.

div {
  box-sizing: border-box;
}
.container {
  width: 60vw
}
.banner {
  height: 17em; /* adjust as needed */
  border-color:red; 
  border-style:solid;
  border-width: 6px 6px 2px;
}
.bottom {
  float: left;
  width: 30vw;
  height: 30vw;
}
.left {
  border-color:green; 
  border-style:solid;
  border-width:4px 3px 6px 6px;
}
.right {
  border-color:blue; 
  border-style:solid;
  border-width:4px 6px 6px 3px;
}
.container::after {
  clear: left
}
<div class="container">
  <div class="banner">
    The top div
  </div>
  <div class="bottom left">
    bottom left
  </div>
  <div class="bottom right">
    bottom right
  </div>
</div>

Answer №2

Here is the requested code snippet for you. By the way, it might be beneficial to enhance your knowledge of HTML/CSS by visiting this site as a supportive resource. Remember not to post similar questions in this community forum.

#numOne{
  width:60%;
  background:red;
  height:60vh;
}
#squareOne{
  background:green;
  width:50%;
  height:40vh;
  float:left;
}
#squareTwo{
  background:blue;
  width:50%;
  height:40vh;
  float:left;

}
#wrapperDiv{
  width:60%;
}
body{
  margin:0;
  padding:0;
}

Check out this link on CodePen

#numOne{
  width:60%;
  background:red;
  height:60vh;
 background-size:cover; background:url(http://lorempixel.com/output/cats-h-g-987-1010-10.jpg);
  background-repeat: no-repeat;
   background-position: center; 
}
#squareOne{
  background:green;
  width:50%;
  height:40vh;
  float:left;
 background-size:cover; background:url(http://lorempixel.com/output/cats-q-g-640-480-3.jpg);
  background-repeat: no-repeat;
   background-position: center; 
}
#squareTwo{
  background:blue;
  width:50%;
  height:40vh;
  float:left;
 background-size:cover; background:url(http://lorempixel.com/output/cats-q-g-640-480-3.jpg);
  background-repeat: no-repeat;
   background-position: center; 
  
}
#wrapperDiv{
  width:60%;
}
body{
  margin:0;
  padding:0;
}
<div id="container">

  <div id="numOne">
  
  </div>
    <div id="wrapperDiv">
  <div id="squareOne">
  
  </div>
  <div id="squareTwo">
  
  </div>

</div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to create a straightforward menu for my HTML game?

I have been working on a basic HTML game and it seems to be functioning more or less. I'm wondering if it's possible to create a simple menu with an image in the background and a "click to start" button within the same file. Any suggestions or ti ...

Instructions for submitting a form using Xcode

How can I automate the submission of a form in a webview? Here is my code: #import <Cocoa/Cocoa.h> #import <WebKit/WebKit.h> #import <WebKit/WebResourceLoadDelegate.h> @interface AppDelegate : NSObject <NSApplicationDelegate> @pro ...

Fetching data using HTML script is not possible

Struggling to retrieve data from mongoDB and send it to the client side using res, but I keep getting undefined. Can anyone offer some assistance? Thank you all! //// server.js app.get('/user/show', userController.userList); //// controller cons ...

What is the best way to update the current route in Angular 2 programmatically?

In my Angular 2 application, I am facing an issue with the navigation flow between the home component and the nav panel component. When a user clicks on the logout button in the nav panel, the current URL is correctly shown as "/login" in the console log. ...

"Struggling to make the 'overflow: hidden' property work for an absolutely positioned

I'm struggling to conceal an absolutely positioned image within a CSS grid layout. Below is the code snippet: HTML: <div class="relative-parent"> <div v-for="item in 12" class="hiding-parent"> <div c ...

Using Material-UI to add a pseudo class '::before' with component class properties

I attempted to utilize a pseudo class for the mui-app-bar but did not have success. I've researched this issue on various platforms without finding a solution. Below is how my component is currently structured: const styles = (theme: Theme) => cre ...

Are there any alternative solutions to the onunload event in Chrome, or any other ways to achieve the

After extensive searching for a solution to this issue, including scouring Google Chrome support sites and the Chrome Bug Issues page where the problem has not yet been resolved. Currently, I find myself in a situation where I need to use the onload or onb ...

Is there a way to separate a string similar to the way bbcode does?

$answer = "This is simply a placeholder text example. WOW! Check out this link [link=http://www.yahoo.com] yahoo yahoo[/link]"; Hey there, I am developing a discussion platform, and my goal is to allow users to use specific tags like [link=*link*]*text*[/ ...

Can you provide instructions on how to display data in two lines within a mat-select field?

Is it possible to show selected options in mat-select with long strings in two lines within the same dropdown? Currently, the string appears incomplete. You can see an example of this issue here: incomplete string example <mat-form-field class="f ...

Tips for implementing X-XSS-Protection: 1; mode=block in HTML

I'm struggling with where to place this piece of code in my existing code. Should it be added to the header section? <head> <meta content="text/html; charset=UTF-8; X-Content-Type-Options=nosniff" http-equiv="Content-Type" /> <title> ...

Instructions for capturing multi-dimensional arrays using forms in Vue

I have a snippet of code that looks like this: <div class="form-item"> <label for="list-0"><?php _e('List 0', 'test'); ?></label> <input name="list[0]" type="text" id="list-0" value=""> </div> &l ...

Issue with Flat-UI: Navigation bar is not collapsing correctly. Need help to resolve this problem

I am currently utilizing the most recent Twitter Bootstrap along with Flat UI. I have been trying to create a basic navbar that collapses when the screen size is reduced. How can I resolve this issue? This is how it currently appears: My navigation items ...

Encountering a Tailwindcss error while attempting to compile the CSS file

Struggling to grasp Tailwind CSS as I try to compile the CSS but keep encountering errors. Despite following numerous tutorials, this persistent error continues to hinder my progress. This is the specific error message that keeps popping up: $ npm run bui ...

Error: Property 'html' is undefined - AJAX response must be displayed only in a specific div

I encountered an issue: Uncaught TypeError: Cannot read property 'html' of undefined I am working on implementing a voting system for each video on my webpage from a database. I have successfully integrated it using AJAX, but the problem is ...

Can a CSS <div> element have margins applied to it?

Can a margin be defined for a text area? My WYSIWYG editor wraps my text within <div> tags instead of using line breaks <br /> So I was thinking of adding a margin to the <div> tag? Is this possible in CSS? If so, how can it be done? ...

Unable to use the same hexadecimal HTML entity in the value props of a React JSX component

Can someone explain why this code snippet displays dots as password and the other displays plain hexadecimal codes? <Field label="Password" value="&#x2022;&#x2022;&#x2022;&#x2022;&#x2022;" type="password" /> While this one disp ...

IE9 causing trouble with CSS vertical alignment

I'm trying to center a button with text using Cuffon for the font, but I can't get it to align vertically and horizontally. The text-align property is working fine, but vertical align isn't. Here's the code for my div block: btndownlo ...

Is it possible to assign a name attribute to the <img> tag in HTML?

Can the "name" attribute be used in an "img" tag in HTML? If you have this knowledge, please do share and thank you in advance. ...

Issue with Hiding Bootstrap Tabbed Content Correctly

I am currently struggling to make a Bootstrap tab field function correctly, encountering some obstacles along the way. While the content is successfully tabbing between each div, the issue I'm facing is that the content from each tab is actually bein ...

What is the best way to extract the numerical value from a JavaScript object?

I'm currently working on a web form for a currency exchange demonstration. I have included a snippet of HTML and Javascript code that I have initially implemented. <!DOCTYPE html> <html lang="en"> <head> <meta charset="ut ...