What is the recommended way to set up a grid system?

After creating a prototype of a landscape design, the next step is to code it using HTML5 & CSS.

To create a responsive layout, I have chosen to utilize grids. Below is the structure that I sketched on paper before diving into coding. However, I am uncertain if the parameters set for the grid template are accurate for achieving responsiveness.

Prototype

https://i.sstatic.net/4wD5D.jpg

Sketch

https://i.sstatic.net/hZYz7.jpg

HTML

   <div class="landscape-grid">
        <div class="landscape-grid__left-bar"></div>
        <div class="landscape-grid__header"></div>
        <div class="landscape-grid__main-content"></div>
        <div class="landscape-grid__video"></div>
    </div>

CSS

.landscape-grid{
    display: grid;
    grid-template-columns: 3.28125% 53.489583333333% 43.2291666666667%;
    grid-template-rows: 75px 168px 711px auto; 
}

I attempted to maintain proportional columns by converting pixels into proportions. However, many designers opt for using fr units and min-content/max-content attributes in their grids. How can I incorporate these techniques effectively in my design?

Your suggestions and insights would be greatly valued!

Answer №1

If you're trying to make a decision like this, it's important to ask yourself some key questions:

  1. What does the design look like on mobile/tablet/responsive views? Flexibility might be better suited depending on the desired appearance.
  2. Are there any fixed elements, such as an image with specific dimensions? If so, consider using fr units with object-fit for proper scaling. If not fixed, adjust other elements based on its size.

When using relative widths, fractional units are typically more effective than percentages, but keep in mind how images will scale.

For a comprehensive guide to grid layouts, check out this resource: https://css-tricks.com/snippets/css/complete-guide-grid/.

To start off, I recommend creating prototypes for mobile and tablet devices. It's hard to create a responsive design without knowing what the layout looks like on smaller screens!

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

To trigger the opening of one offcanvas menu from another offcanvas menu

I am facing a small issue with opening an offcanvas from a previous canvas. Typically, I have a canvas set up like this using Bootstrap 5: <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-tar ...

Incorporating smooth sliding animation to ng-repeat elements

Our team has developed a custom widget in ServiceNow that displays a row of icons and reveals or hides additional details in a div when icons are clicked. Below is the structure of our html and client controller: <div class="icons"> <ul class=" ...

How to display unique content within a div based on individual element hover using AngularJS

As a newcomer to AngularJS, I am facing some challenges while working with directives. Currently, I am working on a navigation menu where my goal is to dynamically display different information within the .services-content section upon hovering over each ...

Using Javascript to save a numeric value and accessing it on a different webpage

I'm encountering an issue with a specific feature on my website. I want users to click on a hyperlink that will redirect them to an application form page. The challenge is ensuring that the reference number (a 5-digit code displayed as a header) is st ...

The mouse pointer adjusts according to the event

I am working on an ajax request and I have implemented a feature where the cursor changes appearance. document.body.style.cursor = "wait"; This immediately shows the cursor as a spinning circle when the request starts. At the end of the request, I ch ...

Tips for changing the size and color of SVG images in a NextJS application

Looking to customize the color and size of an svg image named "headset.svg". Prior to this, I used next/image: <Image src={'/headset.svg'} alt='logo' width={30} height={30} className='object-contain' /> The s ...

Constructing a string with specific formatting inside a For loop

I need assistance with formatting a string within my webform. Currently, I have a function that uses a for loop to output each item in my cart. However, I am struggling to include tab spaces and newline characters for better readability. Here is the code s ...

Exploring the connection between Socket.io and PHP

Is socket.io only beneficial for HTML pages used by clients? I'm looking to set up a node server to send events to my current PHP pages. These pages are not named with the .html suffix and differ from the typical examples shown in chatroom demos. I ...

One solitary table is successfully loaded

I am facing an issue with my setup where I have two HTML tables and a PHP file that loads every 1 second through AJAX to pass information to these tables. Here is the HTML structure: <div style='float: left;'> <br><br> & ...

What methods can be used to stop word-wrap in a table cell and expand the table's width?

My current scenario involves creating a mobile-friendly table using HTML. I need to apply CSS in order to: Ensure that all cells (td) do not break words, but only break at white spaces. Using white-space: nowrap; is not an acceptable solution. Make a ...

Newbie Query: How can I apply various font weights to a single font within the same stylesheet?

Twice I have inserted the font Acumin Pro Condensed, once with a weight of 400 and again with a weight of 700. I attempted to use both weights separately; assigning the 400 weight to an h3 tag and the 700 weight to an h2 tag. However, only the 700 font we ...

The text decoration feature in CSS is not functioning correctly

I have been working on implementing text differencing in JavaScript using a specific code, and so far, it has been working well. Recently, I attempted to enhance the display by adding a text-decoration that would show a line over incorrect parts of the se ...

Having issues with the CSS block in my Jekyll dropdown navbar

I have been exploring resources from both w3schools and another website to create a navigation bar in Jekyll using frontmatter. However, I am running into issues with the block property in CSS. Most of the navbar is functioning properly, except for the dro ...

Distinguish the disparities between mobile and desktop devices

I need a solution for adjusting the layout of a component based on the device it is viewed on. For mobile devices, I want the content to stack vertically like in this example: https://codesandbox.io/s/material-demo-forked-ktoee?file=/demo.tsx. However, o ...

What is the reason for font names appearing yellow rather than blue in the "font-family" property?

Whenever I experiment with different font names, I notice that some fonts turn blue while others remain yellow. Can anyone clarify why this is happening? font-family: Arial, Helvetica, sans-serif; font-size:12px; font-weight:normal; ...

Tips for identifying truncated text when resizing the td element

While using the resize option in my table, I noticed that it cuts off some text. How can I determine the size at which the text begins to get cut off? https://i.sstatic.net/X7tKK.png This issue occurs when I resize the header https://i.sstatic.net/peycT. ...

Widget for tracking attendance - incorporating HTML, CSS, and Bootstrap styling

I recently created a widget named attendance to track monthly data, from January to December. I spent time designing and coding it using HTML, CSS, and Bootstrap, as shown in the image below https://i.sstatic.net/FtFJv.png However, I am now faced with t ...

What are some simple methods for designing a bootstrap layout?

I am in the process of developing a single page application and I need to design customized screens. I have experimented with various online tools for creating bootstrap layouts. Are there any free software options available that can help with screen lay ...

Issues arise when trying to render text within Javascript as "NOTICE", however PHP is able to display it seamlessly without any hiccups

PHP uses metadata from image files to create text and stores it in a variable with the same name as the IMG source. No issues there. JavaScript is responsible for displaying the gallery, allowing users to scroll and enlarge images. While enlarging an imag ...

Breaking down VUE code to enhance collaboration in a team of developers

I'm looking to write code like the example below: index.html- <html> <div id="app1"> <button @click="product-list">Click me</button> </div> <div id="app2"> <button @click="group-list">Click m ...