Tutto Il Web

Main Menu

  • Home
  • Computer networking
  • Web development
  • Web design
  • Internet marketing
  • Web services

Tutto Il Web

Header Banner

Tutto Il Web

  • Home
  • Computer networking
  • Web development
  • Web design
  • Internet marketing
  • Web services
Web development
Home›Web development›About Page – 960 Grid – HTML & CSS – SitePoint Forums

About Page – 960 Grid – HTML & CSS – SitePoint Forums

By Julie R. Kelsey
May 9, 2022
0
0

I just started working on a website for my friend https://test.prygara.com/ which is based on the WordPress Underscores theme and I was wondering what would be the correct way to declare the 960 12 col grid in CSS as mentioned here https://www.wearewibble.com/grid-systems-what-are-they-a-quick-guide/?
According to the article, it looks like the grid they use can be used for both desktop and mobile designs and they use it for almost all of their projects.

We design using the 12 column grid. Just like Rule 960, but expand the container boundaries. We have even columns, just like the 960 rule, and use an even gutter. We modify this for the actual screen size we are designing for.

I currently have the grid declared as follows:

.site {
    display: grid;
    min-height: 100vh;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto 1fr auto;
}

and I did some row based placements but mainly used it for the sticky footer as mentioned here https://developer.mozilla.org/en-US/docs/Web/CSS/Layout_cookbook/Sticky_footers


810311:

12 column grid in CSS

I don’t buy into the 12 column grid system because it seems too restrictive to me and you end up with a site that looks like bootstrap or other similar frameworks. I understand that having a system in place allows for easy alignment, but rarely have I found that a strict grid matches any of the designs I’ve been given to code.:slight_smile:

However, others swear by them, so I guess it all depends on your approach.

I would take a look at something like this as you can get the code and demos for a 12 color grid and adjust them accordingly.

quackit.com

CSS 12 Column Grid Examples

Examples of 12 column grids using CSS grid layout.

In essence, the css grid is already a grid, so all you need to know is the css grid. :slight_smile:



2 likes


810311


May 10, 2022, 02:37


#3

PaulOB:

I understand that having a system in place allows for easy alignment, but rarely have I found a strict grid to match any of the designs…

Thanks for the quick response Paul and the link. I agree. It makes sense. I guess how you declare the grid differs for each project depending on what needs to be done. I’ll come back to this later and maybe try a side project just to better understand the concept of 12 cols.

Can you take a look at the about page at the above URL? When you start resizing the page there are 2 major issues (see screenshot): navigation (not sure where to put that ham icon on smaller screens) and image alignment and text with the footer’s vertical borders. I’m kind of stuck that I don’t know what the best way to handle these is for smaller screens. I’m pretty much ok with the layout of the office.


PaulOB


May 10, 2022, 9:22 a.m.


#4

810311:

Can you take a look at the about page at the above URL?

I’ll take a look this afternoon as I’m going out this morning :slight_smile:


PaulOB


May 10, 2022, 12:40 p.m.


#5

Ok, I took a quick look and that’s where I would start.

Add this code at the end of testing the css file so that it can be edited easily, but once you edit it, you can integrate it properly because it contains new rules and overrides.

#colophon {
grid-template-columns:1fr 1fr 1fr;
}
#colophon > *{
display:flex;
justify-self:center;
border-left:none;
}
.wp-block-page-list,
.wp-block-categories-list,
.wp-block-social-links {
  width: auto;
}
.wp-block-image img.wp-image-62 {
  width: 100%;
  max-width: none;
}
.home .entry-content figure,
.home .entry-content div:nth-child(2),
.home .entry-content div:nth-child(3) {
  flex: 1 0 0;
}

.home .entry-content figure {
  max-width: 500px;
  min-width: 200px;
}
@media screen and (max-width: 880px) {
  .home .entry-content {
    display: block;
  }
  .home .entry-content figure {
    max-width: none;
    min-width: 0;
    float: right;
    width: 180px;
    margin: 20px;
  }
  #colophon {
    display: flex;
    flex-direction: column;
  }
  #colophon > * {
    border-left: none;
  }
}

Your footer was too wide causing a massive scroll bar. So I changed the grid settings, then on smaller screens I centered the menus. You seemed to be trying to match the footer borders to the columns above, but that would be futile unless you had them both contained in a grid. You can’t really match things up by wiring dimensions because it’s a magic number trick that breaks easily. Therefore, I centered the footer and removed the borders and it looks much cleaner in my mind.

For your three columns I adjusted the column widths to better match the large screen, then on the small screen I floated the image to the right and let the text wrap .

You should of course continue to tweak and perhaps reduce the text size a bit for the small screen and your drop caps etc, but I’ll leave that up to you as it’s mostly tweaking.

I’ve only set up one media query to show the process, but you might need another one at smaller widths just to tweak better, but don’t overdo it because you should be able to get away with just a few media queries.

As an exercise I left the header section alone as it also needs to be rearranged, but hopefully you can figure this out on your own now that you have a start. :slight_smile:

With my code in place, you should see a display like the following live screenshots.

Hope this helps but yell if you don’t understand anything.


810311


May 17, 2022, 03:18


#6

PaulOB:

You seemed to be trying to match the footer borders to the columns above, but that would be futile unless you had them both contained in a grid.

Exactly. I’ve tried grid before though, but couldn’t figure out how to vertically align an image, two columns, and those vertical borders in the footer (the ones you removed). And then there was a problem with the column that is next to the image – when resizing for smaller screens, a blank space is formed (this does not look good to me from a design point of view ) below the image when using a grid. Let me try to work with your version and see.


PaulOB


May 17, 2022, 12:38 p.m.


#seven

810311:

Exactly. I tried the front grill but couldn’t figure it out

You would need a structure like this to have lines running together automatically…


810311


May 17, 2022, 1:19 p.m.


#8

Thanks Paul. I’ll take a look later. I’m thinking maybe that instead of floating an image, just stack the image followed by the text of two columns with a horizontal border between them {in this case there would be no white space below the image on smaller screens). Let me try if I can achieve this myself based on your suggestions.



1 like


810311


May 31, 2022, 3:26 p.m.


#9

Hi Paul,
Can you take a look at the screenshot of the post #3 ? I tried drawing a blue arrow from the second column pointing to white space below the image that forms on smaller screen sizes. What I’m trying to achieve is that the text gradually flows under the image when resizing to close that white space.
The current HTML structure is

...
...

I don’t know if this is possible with the HTML structure above. I tried to wrap figure in div then float an image to the left so that the text flows under the image but that doesn’t seem like a good idea…

...


PaulOB


May 31, 2022, 4:06 p.m.


#ten

810311:

achieve is to gradually flow the text under the image

The only way that can happen is if the figure and the column are side by side and not direct children of a grid or flexbox. You would then float the figure and the next div will wrap automatically. You would need a structure like this.

...
...

I just quickly forked my original codepen to show the structure but didn’t take much care :slight_smile:


810311


July 3, 2022, 5:59 p.m.


#12

PaulOB:

As an exercise I left the header section alone as it also needs to be rearranged

Hi Paul,

This is where I am now with the menu. Please see the screenshot below and the code is here https://test.prygara.com/. I took the original code from https://alvarotrigo.com/blog/hamburger-menu-css/.

Should I rearrange the HTML as you mentioned?

Can I make the menu push content down?


PaulOB


July 3, 2022, 7:49 p.m.


#13

810311:

Can I make the menu push content down?

You don’t want to do this because it will create a horrible user experience and cause a whole page re-flow which on small mobile will look very bad. You want the menu to slide over the content and it will do that much easier than if you push all the content down at once, because the mobile will have to redraw all the content on that page.

If you have to, you can make it push the content down by putting the menu back in the flow and changing position:absolute to position:relative in .menu. There would be other adjustments needed as you will need to reposition the burger and store a few other things. However, as I mentioned above, this is not good user design for mobile.

810311:

I took the original code from

This code is invalid because you can’t nest a div inside a label and I wouldn’t trust anyone who did it :slight_smile: Change the div to span and set its display: to block and it will be valid.

You have conflicts in your header that I won’t give specific answers to since I’m on vacation :slight_smile:

First, .site-header is a flex container and only has 2 direct children that will be flex items. (site branding and site navigation). These are side-by-side elements, so the site navigation cannot be 100% wide on the small screen. I would remove position:relative and width:100% from .main-navigation and then your burger would fall back into place.

Then you can absolutely place the .menu top:100% when you also add position:relative to .site-header. This keeps the menu always at the bottom of the header. No magic number is needed.

Also note that you should hide the navigation when displaying the hamburger. At the moment everything is squashed into a single line. You need to hide in the media query and then show it with js when clicked (toggle a class).

The click area on the burger is very small, so you should see if you missed something or if the burger is under another element background. It seems to me that the rows are pulled out of the container and they don’t react properly to a click.

Give the hamburger a higher z-index for the positioned element.

Sorry I can’t give complete answers, but I’m vacationing on a very old and slow computer.:slight_smile:



1 like


810311


July 5, 2022, 03:21


#14

PaulOB:

This code is invalid

I understand. I will try to adapt based on your suggestions and post updates here. Thanks.


810311


July 5, 2022, 03:26


#15

PaulOB:

because you can’t nest a div inside a label

…ok…didn’t notice that in the markup. label is inline and div is at block level…



1 like

Related posts:

  1. Daily Deal: The Modern Web Development and MySQL Programming Pack
  2. What special features of Java are useful in web development?
  3. This training collection explores advanced web development techniques
  4. The 7 Best Websites to Learn Online Web Development

Categories

  • Computer networking
  • Internet marketing
  • Web design
  • Web development
  • Web services

Recent Posts

  • What is web development and why should you pursue it?
  • Web development training focused on reaching rural Kentucky
  • The world’s leading internet marketing and design agency celebrates its 25th anniversary with a surprise announcement
  • Boost Your Business: Web Design Ideas – Chadds Ford Live
  • Step-by-step guide to launching a website

Archives

  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • February 2020
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • November 2018
  • September 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • December 2017
  • November 2017
  • June 2017
  • May 2017
  • April 2017
  • February 2017
  • August 2016
  • February 2016
  • November 2015
  • May 2015
  • January 2015
  • October 2014
  • April 2014
  • January 2014
  • September 2013
  • August 2013
  • June 2013
  • May 2013
  • March 2013
  • August 2012
  • Privacy Policy
  • Terms and Conditions