I have a WordPress site where the menu is floated to the right of a logo in a header. The logo takes up about 25% of the width and the remaining 75% holds 7 menu options. If an 8th menu option is added, it exceeds the available space and the whole menu basically shifts down underneath the logo. I’m sure many of you are familiar with this kind of menu response.
I’d like to be able to implement a certain set of new styles if the menu drops below the logo. So in other words, this isn’t based on browser size but rather the number of menus a client may eventually add to a site. Does anyone know the proper syntax or method of implementing this?
Thanks in advance!
Last year in April they released a newer updated version of the flex property, this works in most browsers, and down to IE10. It is like displaying things inline-block, but it interpolates widths, and allows a heightened flexibility to any responsive inline elements
here is a full description of its capabilities.
http://css-tricks.com/snippets/css/a-guide-to-flexbox/
check out this fiddle
http://jsfiddle.net/yznby99f/3/
essentially you will put these display properties on the parent of whatever it is you want to see displayed inline.
I bet you have something like this
LOGOMenu
floated left
can you try
See if results…
Using the previous fiddle example, I added a small snippet of code to solve your problem!
http://jsfiddle.net/yznby99f/4/
A huge key in responsive web design was available for use when CSS3 was released. that is what is called a media query.
http://www.w3schools.com/css/css_mediatypes.asp
this means that when the screen size is below 699px it will execute any styles within their constraints.
It is important in responsive design to add a “viewport tag” to the of your document. this allows the browser to read and the device width of your user IE: tablet, and smartphone:
https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag
You can also set when styles happen between a 2 pixel widths:
To test the responsiveness in the fiddle drag the right hand side of you browser to the left to shrink the width