How to specify different Css for different Mobiles (BB, Iphone, Nexus… )


Tags: asp.net,html5,mobile,css3,jquery-mobile

Problem :

I am currently developing a mobile web application in ASP.net and jQuery + jQm that will be used on handheld devices. I want to be able to specify a theme for Blackberry, one for Google Nexus and one for IPhone, and not just this ones.

Is there any way I could specify a theme for each one in CSS3? Can you please point out what to do in this case. Also I want that when I rotate screen to keep the design in place for all the devices above.

I am currently experimenting with this :

@media screen and (orientation:landscape) and (max-width: 819px) 

but I am open for other approaches also.

Thanks!



Solution :

You can either check the browser user agent by using javascript or through server-side code.

I recommend this mobile phone detector


    CSS Howto..

    How to center a relative div in my case?

    How to center a child div with a smaller parent div

    How to get the initial value of style properties in javascript? [duplicate]

    How to set relative url for a css file in Django

    How to style a form element when an input is focused?

    Show/Hide tr elements based on multiple CSS classes and input from multiple checkboxes

    How to change css background color dynamically in php using color from database

    How to I center my submit button in CSS?

    How to Add Class to Bootstrap Thumbnails on Slider Change

    How to change width of object in mobile version

    how to apply css on specific td on first tr

    How to align with digits inside to the right, jQuery

    jQuery Cycle Plugin is showing border of auto-generated links

    How can I load css file in Meteor for just one page?

    How can I point out a specific location in Google Maps?

    SceneBuilder (by gluon) doesn't show imported fonts

    CSS: How the backgrounds can extend the border and overlap?

    How do you override CSS applied by jQuery UI theme properly?

    how to do drop down list

    How to change the size of item-avatar in ionic?

    How to override css-setting for the elements of nested table?

    How to remove the margin top from a div with display table-cell?

    How to override default CSS in modern GWT applications?

    How to center a image with transparent background in css?

    How to stop css inheritance in sub unorder list

    how to make a div toggle background-position “onclick” while keeping hover

    How to make inner div of Flexbox height of parent

    Javascript - How to alter a property of a css class

    How to use CSS to adjust HTML5 validation indicator

    How can I create left & right side fixed width elements with a center that fills the remainder?