Widths of footer/ navigation at 100% not equal to widths of header/ container at 100% - mobile

I'm building a website (summer-band.com) and trying to tweak the mobile settings (browser at < 600px) with 100% width settings for several of the elements. Unfortunately, with what I've done so far, the header/ container and the navigation bar as well as the footer all seem to be shooting out different widths and I can't seem to fix this on my own, thus asking for some assistance.

First, the menu: #navigation li a and #navigation li.current_page_item a's width is 100% but has a padding, so the box model won't do what you want. The width should be auto. This is a recurring problem of yours.
Next, the header: You have #headerImg's width set to a constant 600px. In your media query, you'll probably want to make the width and height auto and make the actual img's width 100%.
Moving down, your main #box has a width of 100% and a padding. Due to the box model, this probably won't do what you want. Make the width auto.
Further down, your #footer has a display of inline-block and a width of 100%. You'll probably want to change its display to block and width to auto.
I think that's mostly it, but you might want to set article img's max-width to 100% and remove the explicit width on your Kickstarter screenshot. I don't really know how to deal with the iframe with the video. Sorry.
A few last comments: You seem to be overusing brs and empty p tags rather than using appropriate margins.

Related

How do I make my header move in response to the height of the browser instead of a scroll bar appearing?

http://www.akaskyness.com/
This is in the early stages of development. I want this "cover" page to be non-scrollable, with the height of the white|black background adjusting to the height of the browser window. At the moment, when reducing the height of the browser window, the headers don't shift up proportionally and a scrollbar appears. I'm not really concerned about browser width at the moment because I haven't added any code for that yet.
I think I see what you mean - you want the <h1> and <h2> elements to shift vertically as the viewport height is resized, so that they don't end up off the screen (when it gets too short) and create a scrollbar.
In your current CSS, you try to do this using margin-top:17% on <header>. This seems like a logical approach, except something curious happens: the margin-top never changes, regardless of how you resize the browser vertically.
I'll be honest, this stumped me for a while, so I did some searching around about margin behaviour and found out this critical piece of information: "The percentage is calculated with respect to the width of the generated box's containing block." So the browser height is completely ignored in the calculation! If you resize the width of your browser, you can actually see how your headers move up and down on your webpage.
Well, that completely invalidates using a percentage margin to attempt to vertically align <header> relative to the viewport height. What now? Vertical alignment of elements is actually something lots of other developers have tackled in various ways. Here's a simple one that uses absolute positioning, by only rewriting the styles for <header>:
header {
margin-top:-3em;
position:absolute;
width:100%;
top:50%;
}
Here's a JSFiddle demonstration of this new CSS. Note that margin-top:-3em; is a bit of a guess on (half of) how tall your headers are, so if you don't want to hard-code that value, you'll probably have to look at a different approach for vertical alignment (this is just one of the easiest). Also, if you don't want it vertically centered, just change top:50%; to a different percentage value.
Hope this helps! Let me know if you have any questions.

How to make some divs more responsive than others for different aspect ratios using susy 2

Since it's a bit difficult to explain, I did a mockup to get across as much as possible visually:
http://sassmeister.com/gist/70624a740b1ca4ae7764
(If there's a better way to share a sass gist, let me know. First time using it)
Basically, this is the layout I want for a tablet in landscape mode. What I'm trying to do is make sure it fits perfectly on different tablets with different aspect ratios. Some things are fixed. The main content area is a 16x9 video, so that aspect is locked.
I have the header and footer (main column only) fixed right now as they need to be for portrait mode, but I could bring them into the regular flow if it's helpful for tablet landscape. Anyway, it's all basic responsive right now via susy2, and the sidebar is totally separate so it can scroll independent of the main content. What I would like is for the whole main area including header and footer to fit perfectly with even margins above and below vid, but then have the sidebar column change it's width to match the tablet.
So... if the tablet is wider, the teaser thumbnails go out to 16x9 ratio. If the tablet is narrower, the main column remains unchanged, but the teaser thumbs narrow down to squares.
If it's easier first to just figure out how to responsively shrink the right column only, so the aspect of thumbs is unchanged, that's ok. I just don't want the overall layout to get screwed up on one device vs another because of aspect ratio, so main focus is that the header hits top, footer hits bottom, main vid fits perfectly between them, then sidebar responds to fill in the rest (within reason).
thx for any input. First time making a website here, so lots to learn.
ps. I had vertical scroll enabled for the right column, but disabled it (by adding extra letter to to the scrolling class in scss column) since it's not actually letting me scroll. Not sure if that's because there's no actual content, or it doesn't recognize the empty padded cells as something worthy of scrolling.
You're biting off a lot for your first website, but Sassmeister is a great way to show what you are doing. I approve. :)
One of the problems you'll find is that CSS don't have the concept of aspect ratio built in, so the sort of layout you are attempting is non-trivial. CSS is best at handling widths, and letting everything overflow vertically. It takes some effort to make it handle height well.
If you can get away with it (depending on browser support), your best option is to use flexbox. Flexbox should make this much easier, but doesn't ave a lot of support yet. You could consider table-cells, which have more support, but can be harder to control.
In any case, you should ignore most of Susy for this — at least in laying out the large sections. If you want Susy to help you with grid calculations, ditch the mixins and just use the span() and gutter() functions to help you set widths. Something like this:
.flexbox {
flex: 1;
flex-basis: span(3);
}
.tables {
display: table-cell;
width: span(3);
}
// NOT THIS
.no {
#include span(3);
}
You can go back to using Susy mixins for simpler bits, like the items in the top navigation.

Responsive font size according to window width, is it possible with CSS?

I have made a responsive design on Wordpress and have adjusted everything. The whole layout and slideshows and plugins adjust to the window width, but I can't make the fonts responsive. I have tried many different options with percentages and also now with Vw and Vh. It does work but viewport width and height units have too big intervals and unfortunately when the window resizes the changes are very dramatic. I need some smooth way of reducing font size with the window size with little changes and also preferably minimum width to be set to some fixed unit. Please help me, is it possible with just CSS?
Sounds like you want to have pretty fine control over the font sizing.
There's a great article over on CSS-Tricks that outlines some of your options. Chris recommends using vmin to control the font-size. After experimenting I'd recommend using vmax because it will select the max of vw and vh, which kinda serves as the minimum font-size you mentioned.
Something like:
p {
font-size: 2vmax;
}
Also note: there's a bug in Chrome 20+/Safara 6+ that prevents the font from resizing itself according to the new viewport size.
If this isn't fine-grained enough unfortunately I think you're going to have to use js. I'd recommend going with one of these fine plugins:
SlabText
FitText

Responsive Design with 100% width

I've been researching responsive design recently and had the thought why not use a flow layout instead of something like a 960 grid? From my research, 960 was chosen to fit the most popular monitor size. But on larger or wide screen monitors, there is still a lot of empty space.
The thought I had is shouldn't the largest size for media query be 100% page width? Instead of 960 px?
Can anyone explain why this isn't the norm, or why people default to a fixed width for responsive design?
If you want to use widths wider than 960px, then the Bootstrap grid is one option, so you don't need to reinvent the wheel.
Bootstrap 3 is in the process of being released and while the grid classes have changed you can still get responsive full page layouts or responsive layouts with a max width of 1200px
An example of a full page grid
An example of a max 1200px grid
Foudation used to have max grid options around 1100px though as far as I can tell, out of the box with Foundation 4 the max is now around 1000px. It should be easy enough to change this though by using a custom setting for the width of the .row class
As for your question
The thought I had is shouldn't the largest size for media query be 100% page width? Instead of 960 px?
as #cale_b noted, readability could be an issue with full width layouts unless you are carefull with typography and font sizes. I think it is certainly doable if you are careful with the design though.
It will depend on the site design.
Good luck!

How to set max-height to image's original height in a responsive design?

I'm building a responsive site using WordPress, and images are automatically set to height:100%; width:auto; and the div resizes according to window size. But this often means some images have their height set to higher than their actual height causing pixelation. What i need is something like height: 100%; width:auto; max-height:"image height here". How, if this is possible, is this possible?
The page where this is an issue is here: http://wheretoimmigrate.com/onthemouse/?portfolio=atomic-clothings-2012-campaign
I resolved it by simply making the images larger by adding a transparent background of larger size and different proportions. Tricked the system into treating it like a larger image. Worked perfectly.

Resources