Please critique my alpha 0.3 Flex design

I’ve decided to finally get around to redoing my site design.

I’m really pleased with how flex and @media are working with my simple 2-column layout.

I’ve tested using the Chrome emulator and the 7 browsers I have.
The only issue I see is that in Chrome, IE 11, and Vivaldi, there is a slight containment problem where longer words in the aside overflow at narrow view-port widths and when zoomed.

I see no problems with Opera 12, Edge, Firefox, or Firefox Dev.
The aside moves to after the section when the view-port is narrowed and when zoomed in (tested up to 200% zoom)

Eventually the main “section” content will have more complex elements (tables, highlighted source code, image sliders, etc.) but before I got too deep into it I was hoping for some feedback.

First, the CSS
I think I have some feel for using flex, but I admit that ATM it’s more a “found it, tried it, tested how it works” than it is any real deep understanding.
TBH I still feel confused by how sometimes the “flex” is the CSS property and other times it’s the CSS value. And OMG all the vendor prefixes for different browsers and even different versions of the same browser.

Second, semantics
My alpha 0.1 had “main” inside “section”. The validator passed the mark-up, but it seems it will pass just about any mish-mash of tags without passing judgement on the semantics.

Third, accessibility
The only place I could see that was appropriate for adding a “role” was “main”, but I could very well be missing some and I’d prefer not to do this as a “I’ll do it later” thing.

If you want to test using the logo image, here it is

<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Index</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<style>
* {
  margin, padding: 0;
/* for testing only 
  outline: 1px solid #060;
              */    
}
html {
  background-color: #beb;
  font-size: 100%;
}
body {}
header {}
  nav {
    text-align: center;
	padding: 0.3rem 0.1rem ;
	background-color: #cfc;
  }
    nav a {
	  margin: 0 0.3rem;
	}
  h1 {
    display: -webkit-box;	/* OLD - iOS 6-, Safari 3.1-6 */
	display: -webkit-flex;	/* NEW - Chrome */
	display: -ms-flexbox;	/* TWEENER - IE 10 */
	display: -moz-box;    	/* OLD - Firefox 19- (buggy but mostly works) */
	display: -moz-flex;
	display: flex;			/* NEW, Spec - Opera 12.1, Firefox 20+ */
	
	-webkit-box-align: center;
	-webkit-align-items: center;
	-ms-flex-align: center;
	align-items: center;
	
	-webkit-flex-flow: row wrap;
	flex-flow: row wrap;
	
	margin: 0;
	font-size: 3rem;
	background-image: linear-gradient(10deg, #b4ffc8, #56996a);
  }
    h1 img {
	  margin: 0.5rem;
	}
	h1 span {
	  display: inline-block;
	  margin: 0 0 0 1rem;
	}
.main {
  -ms-box-orient: horizontal;
  display: -webkit-box;		/* OLD - iOS 6-, Safari 3.1-6 */
  display: -webkit-flex;	/* NEW - Chrome */
  display: -ms-flexbox;		/* TWEENER - IE 10 */
  display: -moz-box;    	/* OLD - Firefox 19- (buggy but mostly works) */
  display: -moz-flex;
  display: flex;			/* NEW, Spec - Opera 12.1, Firefox 20+ */

  -webkit-box-pack: justify;
  -webkit-justify-content: space-around;
  -ms-flex-pack: justify;
  justify-content: space-around;

  -webkit-flex-flow: row wrap;

  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  -ms-flex-align: stretch;
  align-items: stretch;

  flex-flow: row wrap;

  background-color: #e9ffe9;
}
  section {
    -webkit-box-flex: 1 100%;
	-webkit-flex:  1 100%;
	-ms-flex:  1 100%;
	-moz-box-flex:  1 100%;
	flex: 5;
	
	-webkit-box-ordinal-group: 2;
	-webkit-order: 2;
	-ms-flex-order: 2;
	-moz-box-ordinal-group: 2;
	order: 2;					/* NEW, Spec - Opera 12.1, Firefox 20+ */
	
	padding: 0.2rem 0.8rem;
	border-left: 2px dashed #beb;
	font-size: 1.1rem;
  }
    section h2 {
	  -webkit-box-flex: 1 100%;
	  -webkit-flex:  1 100%;
	  -ms-flex:  1 100%;
	  -moz-box-flex:  1 100%;
	  flex: 1 100%;
	  
	  margin: 0;
	  font-size: 2rem;
    }
	  section h2 span {}
	section p {}
  aside {
	-webkit-box-flex: 1 100%;
	-webkit-flex:  1 100%;
	-ms-flex:  1 100%;
	-moz-box-flex:  1 100%;
	flex: 1;
	
	-webkit-box-ordinal-group: 1;
	-webkit-order: 1;
	-ms-flex-order: 1;
	-moz-box-ordinal-group: 1;
	order: 1;					/* NEW, Spec - Opera 12.1, Firefox 20+ */
	
	-webkit-box-align: center;
	-webkit-align-items: center;
	-ms-flex-align: center;
	align-items: center;

    padding: 0.2rem 0.4rem 0.2rem 0.8rem;
	border-right: 2px dashed #beb;
	font-size: 1.1rem;
  }
    aside h3 {
	  -webkit-box-flex: 1 100%;
	  -webkit-flex:  1 100%;
	  -ms-flex:  1 100%;
	  -moz-box-flex:  1 100%;
	  flex: 1 100%;
	  
	  margin: 0;
	  font-size: 1rem;
	}
	aside h3 span {}
    aside p {}
footer {
  -webkit-box-flex: 1 100%;
  -webkit-flex:  1 100%;
  -ms-flex:  1 100%;
  -moz-box-flex:  1 100%;
  flex: 1 100%;

  padding: 0.2rem 0.5rem;
  text-align: center;
}
  footer p {}
    footer p a {}
@media only screen and (max-width: 450px) {
  .main, aside, section {
	display: block;
    font-size: 1rem;
  }
  aside {
    border-top: 2px dashed #beb;
  }
  section {
    border-bottom: 2px dashed #beb;
  }
  h1 {
    font-size: 2rem;
  }
  section h2 {
    font-size: 1.5rem;
  }
}
</style>
<script>
// script needed before the DOM is loaded here
</script>
</head>
<body>
  <header><!-- support GOOD -->
    <nav><!-- support GOOD -->
	  <a href="http://www.catipsum.com/">Cat Ipsum</a>
	</nav>
    <h1>
	  <a href="#" title="home link">
	    <img src="images/vernal.jpg" class="logo" width="100" height="75" alt="logo" />
	  </a>
	  <span>Test Index</span>
	</h1>
  </header>
<!-- IE doesn't support main -->
  <div class="main" role="main">
	<section><!-- support GOOD -->
      <h2>
	    <span>Flex Testing</span>
	  </h2>
<p>Chase red laser dot shove bum in owner's face like camera lens missing until dinner time, or pooping rainbow while flying in a toasted bread costume in space, pee in the shoe. Shake treat bag asdflkjaertvlkjasntvkjn (sits on keyboard) for destroy couch, and tuxedo cats always looking dapper, so spot something, big eyes, big eyes, crouch, shake butt, prepare to pounce so eat a plant, kill a hand. Use lap as chair sleep nap so missing until dinner time, yet mew. If it fits, i sits thinking longingly about tuna brine climb leg chase dog then run away but meow. Attack the dog then pretend like nothing happened. Destroy the blinds walk on car leaving trail of paw prints on hood and windshield so inspect anything brought into the house chase after silly colored fish toys around the house meow for food, then when human fills food dish, take a few bites of food and continue meowing. Damn that dog.</p>
<p>Chase the pig around the house you call this cat food? rub face on owner. Immediately regret falling into bathtub cat slap dog in face so leave dead animals as gifts, and kitty power! . Attack the dog then pretend like nothing happened claws in your leg hide from vacuum cleaner for unwrap toilet paper, leave hair everywhere. Steal the warm chair right after you get up attack feet. Stare at the wall, play with food and get confused by dust lick butt. Poop in litter box, scratch the walls the dog smells bad but my left donut is missing, as is my right for claws in your leg. Knock over christmas tree destroy couch. Intrigued by the shower nap all day, but cough furball lick the plastic bag. Peer out window, chatter at birds, lure them to mouth cat slap dog in face so refuse to drink water except out of someone's glass or climb leg. Always hungry stand in front of the computer screen, and knock over christmas tree, stick butt in face who's the baby, so purr while eating and where is my slave? I'm getting hungry.</p><p> Throwup on your pillow. Get video posted to internet for chasing red dot. Then cats take over the world curl into a furry donut eat a plant, kill a hand leave fur on owners clothes chase laser. Lick the plastic bag hopped up on catnip, for give attitude, so missing until dinner time asdflkjaertvlkjasntvkjn (sits on keyboard). Meowwww have secret plans give attitude intrigued by the shower ignore the squirrels, you'll never catch them anyway for sun bathe. Unwrap toilet paper. Vommit food and eat it again chase mice, yet cat is love, cat is life, steal the warm chair right after you get up. Chirp at birds love to play with owner's hair tie, or touch water with paw then recoil in horror. Drink water out of the faucet lick the plastic bag missing until dinner time, for love to play with owner's hair tie. Nap all day cat slap dog in face.</p>
	</section>
    <aside><!-- support GOOD -->
	  <h3>
	    <span>aside</span>
	  </h3>
<p>Poop in litter box, scratch the walls sit by the fire play time, so find something else more interesting, so flee in terror at cucumber discovered on floor but burrow under covers chew on cable. Cough furball who's the baby.</p>
    </aside>
  </div>
  <footer><!-- support GOOD -->
<p>Meowing non stop for food rub face on everything, but paw at your fat belly yet see owner, run in terror, present belly, scratch hand when stroked. Behind the couch use lap as chair has closed eyes but still sees you sleep on keyboard. Why must they do that meow stretch. Claw drapes eat and than sleep on your face steal the warm chair right after you get up. Leave dead animals as gifts hopped up on catnip.
<a href="http://www.catipsum.com/">Cat Ipsum</a></p>
  </footer>
<script>
// script that needs the DOM to be loaded here
</script>
</body>
</html>
1 Like

If you have small side columns then it always good to add ‘word-wrap:break-word’ to the column so that the page isn’t forced wide (very bad for mobile) or the column overflows other content.

I tend not to let small side columns have percentage widths because they soon end up too small. I like to keep a small side column around 280px (or 280px min-width) and then I know I have virtually nothing to do when I resize the page to a single column for mobile as I know the side column will just drop in place with a couple of rules.

Yes flex takes some getting used to and even though I have created quite a few things with it I still find I forget the basics a week later and have to review it again. One of the problems with flex is that you can do the same thing many different ways which makes it confusing when you see a bunch of different properties being used in other peoples layouts that you didn’t need in your own.

Don’t forget to set the new html5 elements to display:block in case some browsers haven’t got around to adding them to their user stylesheet (like ‘main’ in some browsers). I notice you mention that IE doesn’t understand the ‘main’ element but all it needs for modern IE is display:block (IE8 would need the shiv etc). I know you are setting the elements to display:flex but browsers that don’t understand flex and don’t have a user stylesheet for ‘main’ will get the element as inline and thus no dimensions will apply.

Also lose the closing slash on your viewport meta tag as its not needed in html5;)

3 Likes

It wasn’t forcing the page wide (as in horizontal scroll) but some words were ignoring the padding and even the border as seen below. Adding word-wrap: break-word did keep the text contained in the troublesome browsers (Chrome, IE 11, Vivaldi) but I’m not so sure the cure isn’t worse than the poison. Using hyphens: auto helps for fixing the problem in IE 11, but has no effect for Chrome or Vivaldi.
Anyway …

I guess hyphenation would be the most “correct” but I still thinking a little bit of escape before the media query kicks in wouldn’t be so bad.
It seems the browsers that do support hyphenation apply them before they’re needed* if you get what I mean. but maybe using the -ms-hyphens for only IE would be OK,

* except that Edge uses hyphens before using word wrap which I’d prefer not to happen

@Mittineague

I am interested in flex and uploaded and tested your source your source because it is a lot easier to modify to test changes.

W3.org Html Validation

Google Mobile Friendly Test

Jigsaw W3.org CSS Validation

Latter failed and also had numerous warnings.

Failed:

* {
  margin, padding: 0;
/* for testing only 
  outline: 1px solid #060;
*/    
}

Flex does look interesting and I was wondering if the -webkit-flex, -ms-flexbox, etct are necessary or can be disregarded?

For the 7 browsers I have the “new” syntax (no prefixes) alone was enough.
I’ve cleaned up a bit - some were not being applied, some not needed.
I got everything looking good using eg. (some have different values)

display: flex;
flex-flow: row wrap;
flex: 1 1 100%;
order: 2;

Then the fun began. I looked up what would be needed for backwards support

Browser Support
Chrome 4.0+, Firefox 2.0+, Safari 1.1+ including all versions of Safari on iOS support flexbox using the July 2009 working draft syntax. These browsers require prefixed flexbox property names.
Chrome and Safari 3.0+ (including iOS) require the -webkit- prefix,
Firefox requires the -moz- prefix,
and Safari 1.1 and 2.0 require the -khtml- prefix.

Property 		Values 								Initial 	Applies to 				Inh. 	Percentages 	Media
box-align 		start | end | center | baseline | stretch 			stretch 	box elements 				no 	no 		visual
box-direction 		normal | reverse | inherit 					normal 		box elements 				no 	no 		visual
box-flex 		<number> 							0.0 		in-flow children of box elements 	no 	no 		visual
box-flex-group 		<integer> 							1 		in-flow children of box elements	no 	no 		visual
box-lines 		single | multiple 						single 		box elements 				no 	no 		visual
box-ordinal-group 	<integer> 							1 		children of box elements 		no 	no 		visual
box-orient 		horizontal | vertical | inline-axis | block-axis | inherit 	inline-axis 	box elements 				no 	no 		visual
box-pack 		start | end | center | justify 					start 		box elements 				no 	no 		visual 

the “box-” are the 2009 syntax so hopefully can go soon

Internet Explorer 10 supports flexbox using the March 2012 working draft syntax using -ms- prefixed property names.
Chrome 21+, Firefox 20+, WebKit Nightly, and Opera 12.1+ support flexbox using the September 2012 candidate recommendation syntax.
Chrome and WebKit Nightly require the-webkit- prefix.
Firefox and Opera support the un-prefixed property names.

Then researched syntax and added a mess of vendor prefixes to get support for

Chrome		Safari		Firefox		Opera		IE		Android		iOS
20- (old)	3.1+ (old)	2-21 (old)	12.1+ (new)	10 (tween)	2.1+ (old)	3.2+ (old)
21+ (new)	6.1+ (new)	22+ (new)			11+ (new)	4.4+ (new)	7.1+ (new)
Browser Support
Chrome any. Safari any, Firefox any, Opera 12.1+, IE 10+, Android any, iOS any

And I added a progressive enhanced hamburger menu

  • current state alpha 0.4
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Index</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<style type="text/css">
* {
  margin, padding: 0;
/* for testing only
  outline: 1px solid #060;
              */
/*  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  -ms-hyphens: auto;
  hyphens: auto; 
  
  word-break: normal;
  word-wrap: break-word;
*/
}
html {
  background-color: #beb;
  font-size: 100%;
}
body {}

header {
  display: -webkit-box;		/* OLD - iOS 6-, Safari 3.1-6 */
  display: -moz-box;		/* OLD - Firefox 19- (buggy but mostly works) */
  display: -ms-flexbox;		/* TWEENER - IE 10 */
  display: -webkit-flex;	/* NEW - Chrome *//* Safari */
  display: -moz-flex;
  display: flex;			/* NEW, Spec - Opera 12.1, Firefox 20+ */

  -ms-flex-flow: row wrap; /* IE 10 no wrap unless display: inline-block set on child elements */
  -webkit-flex-flow: row wrap; /* Safari 6.1+ */
  flex-flow: row wrap;
}

  nav.desktop {
    -webkit-box-flex: 1; /* 2009 sytax - grow only */
	-moz-box-flex:  1; /* 2009 sytax - grow only */
	-ms-flex:  1 1 100%; /* IE 10  If omitted, the preferred size is 0px */ 
	-webkit-flex:  1 1 100%;
	flex: 1 1 100%;

    text-align: center;
	padding: 0.1rem ;
	background-color: #cfc;
	display: inline-block; /* needed for IE 10 only */
  }
    nav.desktop ul.site_links,
    nav.desktop ul {
      list-style: none;
	  margin: 0;
	  padding: 0;
    }
      nav.desktop ul li {
	    margin: 0 0.3rem;
        display: inline-block;
	  }
	    nav.desktop ul li a {}
  nav.mobile {
    -webkit-box-flex: 1; /* 2009 sytax - grow only */
	-moz-box-flex:  1; /* 2009 sytax - grow only */
	-ms-flex:  1 1 100%; /* IE 10  If omitted, the preferred size is 0px */ 
	-webkit-flex:  1 1 100%;
	flex: 1 1 100%;

    display: none;
  }
    nav.mobile img {
	  display: block;
	}
	nav.mobile ul.site_links {
      display: block;
	}
      nav.mobile ul li {
	    margin: 0.3rem 0;
        display: block;
	  }

  h1 {
    -webkit-box-flex: 1; /* 2009 sytax - grow only */
	-moz-box-flex:  1; /* 2009 sytax - grow only */
	-ms-flex:  1 1 100%; /* IE 10  If omitted, the preferred size is 0px */ 
	-webkit-flex:  1 1 100%;
    flex: 1 1 100%;

	margin: 0;
	padding-top: 0.5rem;
	background-color: #b4ffc8;
	background-image: linear-gradient(10deg, #b4ffc8, #56996a);
	display: inline-block; /* needed for IE 10 only */
  }
    h1 a {
	  text-decoration: none;
      padding: 0.5rem;
	}
      h1 a img {}
	h1 span {
	  display: inline-block;
	  margin: 0 0 0 1rem;
	  font-size: 3rem;
	}

/*
Chrome		Safari		Firefox		Opera		IE			Android		iOS
20- (old)	3.1+ (old)	2-21 (old)	12.1+ (new)	10 (tween)	2.1+ (old)	3.2+ (old)
21+ (new)	6.1+ (new)	22+ (new)				11+ (new)	4.4+ (new)	7.1+ (new)
Browser Support
Chrome any. Safari any, Firefox any, Opera 12.1+, IE 10+, Android any, iOS any
*/
.main {
/* maybe change to main tag and use display block to force IE recognition */  
  display: -webkit-box;		/* OLD - iOS 6-, Safari 3.1-6 */
  display: -moz-box;		/* OLD - Firefox 19- (buggy but mostly works) */
  display: -ms-flexbox;		/* TWEENER - IE 10 */
  display: -webkit-flex;	/* NEW - Chrome *//* Safari */
  display: -moz-flex;
  display: flex;			/* NEW, Spec - Opera 12.1, Fir

  -ms-flex-flow: row wrap; /* IE 10 no wrap unless display: inline-block set on child elements */
  -webkit-flex-flow: row wrap; /* Safari 6.1+ */
  flex-flow: row wrap;

  background-color: #e9ffe9;
}

  section {
    -webkit-box-flex: 5; /* 2009 sytax - grow only */
	-moz-box-flex: 5; /* 2009 sytax - grow only */
	-ms-flex: 5 1; /* IE 10  If omitted, the preferred size is 0px */ 
	-webkit-flex: 5 1;
	flex: 5 1;

	-webkit-box-ordinal-group: 2;	/* OLD - iOS 6-, Safari 3.1-6 */
	-moz-box-ordinal-group: 2;		/* OLD - Firefox 19- */
	-ms-flex-order: 2;				/* TWEENER - IE 10 */
	-webkit-order: 2;				/* NEW - Chrome */
	order: 2;						/* NEW, Spec - Opera 12.1, Firefox 20+ */

	padding: 0.2rem 0.8rem;
	border-left: 2px dashed #beb;
	font-size: 1.1rem;
	display: inline-block; /* needed for IE 10 only */
  }
    section h2 {
	  margin: 0;
	  font-size: 2rem;
    }
	  section h2 span {}
	section p {}

  aside {
    -webkit-box-flex: 1; /* 2009 sytax - grow only */
	-moz-box-flex: 1; /* 2009 sytax - grow only */
	-ms-flex: 1 1; /* IE 10  If omitted, the preferred size is 0px */ 
	-webkit-flex: 1 1;
	flex: 1 1;

	-webkit-box-ordinal-group: 1;	/* OLD - iOS 6-, Safari 3.1-6 */
	-moz-box-ordinal-group: 1;		/* OLD - Firefox 19- */
	-ms-flex-order: 1;				/* TWEENER - IE 10 */
	-webkit-order: 1;				/* NEW - Chrome */
	order: 1;						/* NEW, Spec - Opera 12.1, Firefox 20+ */

    padding: 0.2rem 0.4rem;
	border-right: 2px dashed #beb;
	font-size: 1.1rem;
	display: inline-block; /* needed for IE 10 only */
  }
    aside h3 {
	  margin: 0;
	  font-size: 1.5rem;
	}
	aside h3 span {}
    aside p {}

footer {
  padding: 0.2rem 0.5rem;
  text-align: center;
  display: block;
}
  footer p {}
    footer p a {}

@media only screen and (max-width: 450px) {
  .main, aside, section {
	display: block;
    font-size: 1rem;
  }
  nav.desktop {
    display: none;
  }
  nav.mobile {
    display: block;
	background-color: #cfc;
  }
    nav.mobile img {
	  margin: 0.1rem;
	  display: none;
	}
	nav.mobile ul.site_links {
	  margin: 0.1rem;
	  padding: 0;
	  text-align: left;
	}
      nav.mobile ul li {
	    margin: 0.3rem 0;
        display: block;
	  }
  h1 {
    font-size: 2rem;
	display: inline-block; /* needed for IE 10 only */
  }
  h1 span {
    margin: 0 0 0 0.3rem;
  }
  section {
    border-bottom: 2px dashed #beb;
	display: inline-block; /* needed for IE 10 only */
  }
    section h2 {
      font-size: 1.5rem;
    }
  aside {
    border-top: 2px dashed #beb;
	display: inline-block; /* needed for IE 10 only */
  }
    aside h3 {
      font-size: 1.2rem;
    }
}
</style>
<script>
// script needed before the DOM is loaded here
</script>
</head>
<body>
  <header><!-- support GOOD -->
    <nav class="desktop"><!-- support GOOD -->
	  <ul class="site_links"><li><a href="browser-tag-support.php" 
						tabindex="1" 
						accesskey="" 
						title="browser-tag-support">browser-tag-support</a></li><li><a href="flex-support.php" 
						tabindex="2" 
						accesskey="" 
						title="flex-support">flex-support</a></li><li><a href="index-01.php" 
						tabindex="3" 
						accesskey="" 
						title="index-01">index-01</a></li><li><a href="index-02.php" 
						tabindex="4" 
						accesskey="" 
						title="index-02">index-02</a></li><li><a href="index-03.php" 
						tabindex="5" 
						accesskey="" 
						title="index-03">index-03</a></li><li><a href="index.php" 
						tabindex="6" 
						accesskey="" 
						title="index">index</a></li></ul>	  <ul>
	    <li><a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/" title="Chris Coyier">A Complete Guide to Flexbox</a></li>
	    <li><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Using_CSS_flexible_boxes" title="MDN">Using CSS flexible boxes</a></li>
	    <li><a href="http://codepen.io/enxaneta/full/adLPwv/" title="CodePen">Flexbox playgroung </a></li>
	  </ul>
	</nav>
    <nav id="mobile_nav" class="mobile"><!-- support GOOD -->
	  <img src="images/hamburger-menu.png" id="hamburger_menu" width="25" height="25" alt="menu">
	  <ul class="site_links"><li><a href="browser-tag-support.php" 
						tabindex="1" 
						accesskey="" 
						title="browser-tag-support">browser-tag-support</a></li><li><a href="flex-support.php" 
						tabindex="2" 
						accesskey="" 
						title="flex-support">flex-support</a></li><li><a href="index-01.php" 
						tabindex="3" 
						accesskey="" 
						title="index-01">index-01</a></li><li><a href="index-02.php" 
						tabindex="4" 
						accesskey="" 
						title="index-02">index-02</a></li><li><a href="index-03.php" 
						tabindex="5" 
						accesskey="" 
						title="index-03">index-03</a></li><li><a href="index.php" 
						tabindex="6" 
						accesskey="" 
						title="index">index</a></li></ul>	</nav>

    <h1>
	  <a href="index.php" title="home link">
	    <img src="images/vernal.jpg" class="logo" width="100" height="75" alt="logo">
	  </a>
	  <span>Test Index</span>
	</h1>
  </header>
<!-- IE doesn't support main -->
  <div class="main" role="main">
	<section><!-- support GOOD -->
      <h2>
	    <span>Flex Testing</span>
	  </h2>
<p>Chase red laser dot shove bum in owner's face like camera lens missing until dinner time, or pooping rainbow while flying in a toasted bread costume in space, pee in the shoe. Shake treat bag asdflkjaertvlkjasntvkjn (sits on keyboard) for destroy couch, and tuxedo cats always looking dapper, so spot something, big eyes, big eyes, crouch, shake butt, prepare to pounce so eat a plant, kill a hand. Use lap as chair sleep nap so missing until dinner time, yet mew. If it fits, i sits thinking longingly about tuna brine climb leg chase dog then run away but meow. Attack the dog then pretend like nothing happened. Destroy the blinds walk on car leaving trail of paw prints on hood and windshield so inspect anything brought into the house chase after silly colored fish toys around the house meow for food, then when human fills food dish, take a few bites of food and continue meowing. Damn that dog.</p>
<p>Chase the pig around the house you call this cat food? rub face on owner. Immediately regret falling into bathtub cat slap dog in face so leave dead animals as gifts, and kitty power! . Attack the dog then pretend like nothing happened claws in your leg hide from vacuum cleaner for unwrap toilet paper, leave hair everywhere. Steal the warm chair right after you get up attack feet. Stare at the wall, play with food and get confused by dust lick butt. Poop in litter box, scratch the walls the dog smells bad but my left donut is missing, as is my right for claws in your leg. Knock over christmas tree destroy couch. Intrigued by the shower nap all day, but cough furball lick the plastic bag. Peer out window, chatter at birds, lure them to mouth cat slap dog in face so refuse to drink water except out of someone's glass or climb leg. Always hungry stand in front of the computer screen, and knock over christmas tree, stick butt in face who's the baby, so purr while eating and where is my slave? I'm getting hungry.</p>
<p> Throwup on your pillow. Get video posted to internet for chasing red dot. Then cats take over the world curl into a furry donut eat a plant, kill a hand leave fur on owners clothes chase laser. Lick the plastic bag hopped up on catnip, for give attitude, so missing until dinner time asdflkjaertvlkjasntvkjn (sits on keyboard). Meowwww have secret plans give attitude intrigued by the shower ignore the squirrels, you'll never catch them anyway for sun bathe. Unwrap toilet paper. Vommit food and eat it again chase mice, yet cat is love, cat is life, steal the warm chair right after you get up. Chirp at birds love to play with owner's hair tie, or touch water with paw then recoil in horror. Drink water out of the faucet lick the plastic bag missing until dinner time, for love to play with owner's hair tie. Nap all day cat slap dog in face.</p>
	</section>
    <aside><!-- support GOOD -->
	  <h3>
	    <span>aside</span>
	  </h3>
<p>Poop in litter box, scratch the walls sit by the fire play time, so find something else more interesting, so flee in terror at cucumber discovered on floor but burrow under covers chew on cable. Cough furball who's the baby.</p>
    </aside>
  </div>
  <footer><!-- support GOOD -->
<p>Meowing non stop for food rub face on everything, but paw at your fat belly yet see owner, run in terror, present belly, scratch hand when stroked. Behind the couch use lap as chair has closed eyes but still sees you sleep on keyboard. Why must they do that meow stretch. Claw drapes eat and than sleep on your face steal the warm chair right after you get up. Leave dead animals as gifts hopped up on catnip.
<a href="http://www.catipsum.com/">Cat Ipsum</a></p>
  </footer>
<script>
// script that needs the DOM to be loaded here
var mobile_nav_hamburger_img = document.getElementById("hamburger_menu");
mobile_nav_hamburger_img.style.display = "block";
var mobile_nav_ul = document.getElementById("hamburger_menu").parentNode.querySelector('.site_links');
mobile_nav_ul.style.display = "none";
mobile_nav_hamburger_img.addEventListener('click', function () {
  mobile_nav_hamburger_img.style.display = "none";
  mobile_nav_ul.style.display = "block";
});
mobile_nav_ul.addEventListener('click', function () {
  mobile_nav_ul.style.display = "none";
  mobile_nav_hamburger_img.style.display = "block";
});
</script>
</body>
</html>

Yes, the validator doesn’t like the universal “*” selector
The Warnings are that the validator doesn’t like the prefixes.

AFAIK the Warnings can be ignored. I’m not so sure about the “*” selector. I don’t think it hurts anything, but I’ll probably get rid of it at some point soon.

There is nothing invalid about the universal selector, but this snippit is invalid

1 Like

I have amended the script and there are no longer any errors but the warnings are still there :frowning:

Jigsaw CSS W3.org Validation No Errors, has warning

Incorrect

* {
  margin, padding: 0;
}

Amended

* {
  margin:0; padding: 0;
}

Pipped at the post :frowning:

1 Like

lol Thanks. I should know better to not use selector syntax as a property

Sad thing is, I looked at that more than once and just couldn’t see it.

EDIT
Fixing that, made adding margin (or something else if you prefer padding eg.) to the p tags necessary.

2 Likes

The universal reset can also upset some form elements (especially historically) and is the reason I avoid it other than for demos. You will of course now need to set appropriate margins and padding for all the elements you use such as p, ul,ol hn etc. A properly targeted reset is better along with a set of common defaults for the layout in question.

The problem is that on mobile when words break out of the container will hold the viewport open and the layout will get squashed to the side as overflow has to be accounted for. Those columns are far too narrow and you should stop them getting to that point as they are of no use to anyone at that width.

Having a fluid site doesn’t mean that you can let all columns collapse to nothing and you need to take control at some stage and ensure that there is plenty of width available for the content.

Browsers don’t do hyphenation very well at all (yet) and I prefer to use word-wrap:break-word to avoid any nasty surprises. Of course if you ensure that columns don’t get too small in the first place then the issue almost disappears. This is where flex box is great and you can set a min-width on a column and 2 columns will go into single wider columns automatically without the need for media queries.

1 Like

Maybe not what you had in mind, but I have a tendency to think in tangents at times and so I took another look at flex-shrink as previous reading left me with an incomplete and vague understanding. of it.

I hope this time I’ve finally “got it”

flex is shorthand for flex-grow, flex-shrink and flex-basis

While at CSS Tricks I read that “basis is the size the element wants to be” and this time it clicked.

flex-basis is what size the element would be when the view-port dimension is “perfect”
It follows that flex-grow affects the size when the view-port is larger than “perfect” and flex-shrink affects the size when the view-port is smaller than “perfect”.

Some Maths I’m not caffeinated enough to think about ATM but both flex-grow and flex-shrink are proportions tied to whatever flex-basis is.

I had wanted the two columns to be 1 width to 5 widths, i.e the “main” column 5 times as wide as the aside.

Trouble being when the “1” got too narrow to contain longer words.

But in this case, because the content is only text, it is not critical that the 1 to 5 ratio be maintained.
I’m sure more tweaking is imminent but the following changes narrow the wider element “faster” so the display approaches a 1 to 1 ratio and the media query steps in before any text comes close to overflowing

  section {
    -webkit-box-flex: 5; /* 2009 sytax - grow only */
	-moz-box-flex: 5; /* 2009 sytax - grow only */
	-ms-flex: 5 2 10rem; /* IE 10  If omitted, the preferred size is 0px */ 
	-webkit-flex: 5 2 10rem;
	flex: 5 2 10rem;
  aside {
    -webkit-box-flex: 1; /* 2009 sytax - grow only */
	-moz-box-flex: 1; /* 2009 sytax - grow only */
	-ms-flex: 1 1 10rem; /* IE 10  If omitted, the preferred size is 0px */ 
	-webkit-flex: 1 1 10rem;
	flex: 1 1 10rem;

To me the most baffling thing about flex is the behaviour of flex-grow and flex-shrink. What are the mathematics behind it?

I just found this that looks helpful.

I don’t feel so bad now. Even the guest poster Manuel Matuzovic admits

we didn’t know what we were doing.

1 Like

Flex grow doesn’t make columns once or twice as big as the other columns it just distributes the left over space between the columns on the basis of what you specify (flex 2 gives the column twice us much of the remainder space as an element with flex:1)/

Flex-shrink allows a column to shrink in the same way as above but compared to the other items. It means that an item can shrink quicker than the other items depending on available width

Min-width is much more useful though.

At its simplest level you get a fully responsive layout without media queries.

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
.parent {
	display: flex;
	flex-flow: row wrap;
}
.child {
	flex: 1 0 33%;
	min-width: 15em;
	background:red;
	border:1px solid #fff;
	box-sizing:border-box;
}
</style>
</head>

<body>
<div class="parent">
		<div class="child"><p>test</p></div>
		<div class="child"><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p></div>
		<div class="child"><p>test</p></div>
</div>
</body>
</html>

Or from 4 columns to one with no media queries.

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
.parent {
	display: flex;
	flex-flow: row wrap;
}
.child {
	flex: 1 0 25%;
	min-width: 15em;
	background:red;
	border:1px solid #fff;
	box-sizing:border-box;
}
</style>
</head>

<body>
<div class="parent">
		<div class="child">test</div>
		<div class="child">test</div>
		<div class="child">test</div>
		<div class="child">test</div>
		<div class="child">test</div>
		<div class="child">test</div>
		<div class="child">test</div>
		<div class="child">test</div>
		<div class="child">test</div>
		<div class="child">test</div>
		<div class="child">test</div>
		<div class="child">test</div>
</div>
</body>
</html>

Or:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
.parent {
	display: flex;
	flex-flow: row wrap;
}
.child {
	flex: 1 0 20%;
	min-width: 15em;
	background:red;
	border:1px solid #fff;
	box-sizing:border-box;
}
.child2{flex:2 0 60% }
</style>
</head>

<body>
<div class="parent">
		<div class="child child1"><p>test</p></div>
		<div class="child child2"><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p><p>test</p></div>
		<div class="child child3"><p>test</p></div>
</div>
</body>
</html>
1 Like

Well, I think I’m pretty much done with this exercise.

I’ll likely go through a few more tweak - break - fix - tweak - break - fix cycles after it’s been on the shelf for a while.

But of course I’m always open to suggestions on how to improve things

If you have a localhost PHP dev environment*, please try it out
* If you don’t have PHP everything should still work except that a few links will be missing

mittineague.zip (106.7 KB)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.