Responsive application with vanilla css - html

I'm trying to build an app that looks great on all devices but I'm having an issue with the responsiveness, actually I have a dought for what should I do. so here is what I'm thinking about:
1- If I build the app using the device toolbar which means I start with a media querie of 320px up to 1440px
like this :
and that's what I did actually and everything is going Ok at least that's what I thought but when I use the viewport width ( increasing, decreasing it) I see some unexpected results
this is on 605px viewport width:
I built this app with absolute positioning and I applied a position relative to the img in the background, maybe this is bad practice I know , please note that the app looks great on all devices that the device toolbar offers me.
some of my friends adviced me to use a framework and get rid of all these headaches but really I wanna practice vanilla CSS very well please consider that this is my first app and I'm doing my best to make it look great on all devices
so my question is:
should I leave it like this because logically If it looks ok on the
devices like Iphone 6 ... (the devices that the device toolbar
offers me) I don't need to address the viewport width issue.
or should I use a framework and I don't like this solution I know
it's feasible and as I told you I wanna practice vanilla css.
or should I use another technologie like flexbox or grid system and
this is the hardest solution I think because I'm gonna rebuild the
entire app, but it's ok.
and the last thing I wanna ask about is: is there anythings should I be aware of in my future projects especially if I'm working with vanilla CSS

Congrats on building your first app!
1) When posting questions on Stackoverflow, it is always helpful to provide either an example of your code directly in your post, and/or to include a link to a running version of your code on a site like jsfiddle.net, JSbin.com, codepen.io, etc.
2) For most responsive apps, there are almost always a couple of widths where things do not look exactly perfect. These points are usually right before/after a breakpoint transition.
3) In general, you don't want to use position relative or absolute for handling page layout. There are a number of situations where they can be helpful, but I think its safe to say that they should never be the first thing you reach for when trying to create the layout of a page.
4) Right now, the best way to handle page layout with regular CSS -- no library -- is probably Flexbox because of its versatility and adoption of all major browsers. I highly recommend you learn it and become familiar with it.
5) There is nothing wrong with using a library for general page structure stuff. Because of its use with a ton of companies, I highly recommend you become familiar with Bootstrap -- specifically its grid framework. If you do go this route, read the rules for certain things very carefully. For example, I cannot tell you how many people have their apps look screwed up because they don't follow the cardinal rule of Bootstrap's grid system: The only children of a row should be col. Say that 10 times.
Best of luck to you!

Related

Layout / Use of Grid System

Hi Im currently creating a Website (who isn't?). My Website Design Looks like this:
Desktop Version:
Mobile Version:
(Sorry for the Big Images)
As you can see, ist not much changing.
Sidebar and the Global Nav are disabled in the Mobile Version (MenĂ¼ via o/Off Canvas)
The main Content Layout Changes.
The Layout in the Content divs Changes too. (Use nested Colums fot that in the Grid System?)
My Question is: Should I use a Grid System? If Yes: Should I just use it for the Orange Content Area or for the hole Website?
Added: The Site should is Full with!
As mmgross said, you're asking a pretty broad question that comes down to taste and experience in design.
There are a number of tools and frameworks that give you access to an already defined grid system; Bootstrap is probably the best known but Foundation CSS is becoming very popular and is lighter weight. If you're not planning to do much intricate styling and just want a preexisting grid, my personal choice is Skeleton - it's very lightweight but adds the grid/responsiveness you're [probably] looking for.
This brings up the other main point: how experienced are you using HTML/CSS? One of the big benefits of using a grid is the responsiveness that comes from them without writing a number of media queries. Still, you'll have to at least write one media query to detect if mobile, so if you're comfortable with position in CSS then it might be best just to pass over grids and write it all yourself (looking at your layout, that's what I'd probably do).
It's always a trade off between time it takes to do the task and time it takes to learn something new, so keep in mind that the learning curve for some of the frameworks might be steeper than you think. Then again, if you're experienced with using them, it will probably be easier to stick with what you know than play around with the raw CSS.
Hope that helped!

Bootstrap Columns with height defined as percentage of row width

Complex Grid Layout, Help!
I'm making a responsive website using bootstrap 3.0.2 and can't figure out the layout that is stated in the requirements document for the project. I made an image of what I need, and will give more detail, or update my question, if needed. I am open to any suggestion on how to accomplish this.
The Issue
This image describes what I need the design to look like at three different widths.
I should add, each box will be basically a div with an image, article title and summary within it.
Like to say ... in advanced
Id like to say thanks and apologize in advanced if the question is dumb or the answer is obvious. I have been a dev for a long time, but I'm new to responsive design and I've been banging my head on the wall trying to get this to work
The problematic part of your project is to make two smaller blocks side with a bigger one and make these two 50%. As far as I know, there are no mature cross-browser solutions that would accomplish that without javascript.
You may want to take a look at: Flexbox and for Comrade IE Flexie.
Another approach to accomplish the same could be using viewport dimensions. Just be aware of the browsers support.
All in all, if you can do that, I would suggest just using JS, with a fallback to css that will not break the site's look too much. Having just finished a project with similar requirements, I would just like to say good luck.

Responsive gridding what is it and how to achieve it

I just tested few of my webpages in cross browsers testing tool and found out that for lower resolutions all my divs were not coming separately.
Afters googling I found out about responsive griding.
After reading that I wanted to ask that whether responsive griding is nothing but making your web page responsive to different changes in screen sizes or does it have anything more to it
Also I am using purecss to make my web page responsive so I needed to know whether this is the right way or and what other ways are there to do this.
Pretty much, it's also about curtailing content based on your audience. Say that people on mobile don't need to read all the reviews on the page you would hide it or show it in a different way. Whether or not to use pure is completely your personal preference. There are a gargantuan amount of responsive frameworks, you should look at what they offer to your own goals of customization or extensibility. Foundation for example offers lovely JavaScript addons you can use for modals, sliders and navigation.
Good luck and please add to your question if you need to ask more!
Your choice to use pure I feel is a good one because its extremely light weight and style agnostic. While bootstrap and foundation are more popular choices they can be up to 10 to 20 times larger.
Check out TukTuk as well, its similar in nature to Pure:
http://tuktuk.tapquo.com/
Yes, you've got the right idea. You can use frameworks like Twitter Bootstrap, or Zurb Foundation, which have all the CSS you need for responsive grids. The basic idea is using CSS media queries to apply different CSS rules for different screen sizes. Javascript can also be used to show/hide features which might work better on mobile.

Would responsive design be the way to go in this case?

I have coded a very complex php game with around 40 pages. I am now in the process of designing it. Would responsive design be the right choice in this case? What other options are available? Maybe I should just make three layouts (3 different stylesheets - normal, tablets and mobiles)?
It just seems like a ridiculous amount of work moving all these elements since there are so many pages.
Creating a responsive site is not that difficult from the html/css point of view, although I'm not sure how your php will affect that. You actually always have the same classes/ids, and just apply styles to them using the media queries (inside the same sheet). It would mean a lot more effort to write 3 separate sheets, but then again: depends on your code. In general, the trick is just to have good semantic, clean code (use positions wisely, for example). It takes some time to get everything organised at first, but once you have the basics structured with responsiveness in mind it gets really easy. Those 40 pages should all have the same structure, right?
Another option would be a liquid design. Instead of changing the styles, you use percentages or dynamic measures. But I strongly recommend grids, and you only have to do it once and it won't be long until everyone does responsive sites.
But if the game is complex and need some serious tweaking, you should consider doing a completely separate thing for mobile (tablets should be easy enough to adapt, your choice). It really depends on the product design, things can look very different in 320px wide. Good luck with the game!
If the content will be the same on all the devices and you can't think of a good reason to fork the code to provide different content for different devices, responsive design is the way to go.

Most efficient way to cater for different web devices?

Folks voting to close as not constructive, read the whole thing please. Specific questions at the end. Looking for real world examples and approaches.
Context
With numerous devices like smart-phones, tablets being used increasingly to access the web its important to plan, design (responsively) and develop (esp. your front end) to give the devices a fast and tailored user experience.
There's some amazing sites being built. Have a look at mediaqueri.es (resize your browser)
We see approaches such as
big screen first, then target smaller devices.
mobile first then media queries to spice things up for bigger screens.
device detection with different techniques (including server side)
and serving completely different markup and content to devices.
Question(s)
What are you folks doing out there today? Why did you choose your approach and most importantly if it isn't the most efficient approach to tackle this, then what is?
Things I'm looking for:
Is it a pure CSS / JS / HTML approach, or server side, or a combination - why?
Each device gets only the resources (images etc.) that it needs so it performs well
Maintenance of the site is easier, i.e. adding / changing features is not a huge pain
Some code samples are always useful
lets leave out old shitty browsers like ie7 and below
I think what you are looking for is Responsive Web Design.
See:
http://www.alistapart.com/articles/responsive-web-design/
http://coding.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/
Responsive Web Design (using CSS) does not necessarily address performance issues but is a good starting point. Keeping in mind that premature optimization is the root of all evil, you can profile your users and bandwidth and determine where you need to optimize once you have a working design in place.
For a discussion of some of the downsides, e.g., image resizing in the browser (you can work around this with CSS and/or AJAX, though), see:
http://www.webdesignshock.com/responsive-design-problems/
You will want to use a framework like PhoneGap. HTML evolves slowly but every day, about 10 new devices with new bugs "features" hit the market and you innocent app - there simply is no way for a small group of people to handle the necessary work.
As for different devices, there are two trouble areas:
Screen sizes
Render bugs
For screen sizes, there are pretty cool solutions today. For example, some frameworks add the CSS style "640x400" or "480x800" to the body element. That makes it dead simple to style elements depending on the screen size. Or you can use JavaScript pull in the matching style sheets.
For render bugs, you'll need workarounds. As I said above, this is nothing a single person or a small group can handle. Every few months, there is a new version of Android with a new render engine and new "features". You fix problems for one of them and break ten others at the same time. Select a framework which plays well with many devices and which is open to changes (read: avoid anything proprietary).
That way, you get solutions for the common problems and you can fix small issues yourself.
I would definately recomment RedFilters Answer (+1).
I just wanted to add some libraries which you might find interesting relating to this topic. They involve Browser feature detection & conditional resource loading.
check them out:
http://www.modernizr.com/
http://yepnopejs.com/