Another approach is to build multiple versions of a website and use server side detection to then present custom code for that device or viewport size.
You could decide to have your mobile site on a separate domain for example m.domain.com. The server will then automatically serve all mobile traffic to that domain.
The server could also perform dynamic serving of page content so that you have just one domain name.
The downsides to this approach is it requires complex server side detection code and is harder to maintain multiple site versions.
Term: Adaptive Web Design