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..
To center your .container you have to make sure its parent has a set width. This could be your body tag or a div that is a container. Then, you...
Vote to Close almost has it, but with the 1px width, the element doesn't get centered. Do this instead: .popup-container { position: fixed; left: 0; right: 0; z-index: 9999; text-align:center;...
Javascripts element.style only returns inline styles, for other styles, for instance set in a stylesheet, you'd have to use getComputedStyle var longbox = document.getElementsByClassName("long_box")[0]; var styles = window.getComputedStyle(longbox); var lef...
The problem maybe is: You don't loaded tag for staticfiles. {% load staticfiles %} You should load staticfiles first, and then you can use static tag....
If the structure in your actual code is the same as what you've posted in question, you can use + (adjacent) selector to select the submit button when there's focus...
Try jQuery(function ($) { var $ins = $('input[type="checkbox"]'), $trs = $('tr.stylingClass'); //change handler for checkboxes $ins.change(function () { //get the value of all checked checkboxes var vals = $ins.filter(':checked').map(function ()...
Create an inline style using php when you originally output the .overlay-custom. <?php // load overlay color from database somehow $overlay_color = get_overlay_color(); ?> <div class="overlay-custom" style="background-color:#<?php echo $overlay_color ?>"></div>...
Here's the working fiddle: https://jsfiddle.net/qptgsc1e/ Just some minor changes, Replace this CSS and HTML and you're good to go. If you want to see the code changes Check it here...
You can change the on slide function to do that (added the 2 bottom lines): // When the carousel slides, auto update the text $('#myCarousel').on('slid', function (e) { var id...
NEW answer: I guess you just want a wider form on the small screens. Your site is adjusted in a wrapper, so the width:80% is small on a small screen....
Use angular's ng-class directive to apply the styles conditionally: <table> <tr ng-repeat="person in persons | orderBy:'name'"> <td>{{person.name}}</td> <td ng-class="{'myClass':$index==0}">{{person.email}}</td> </tr> </table> ...
How to align with digits inside to the right, jQuery
You can use the filter option: $('td').filter(function() { return this.innerHTML.match(/^[0-9\s\.,]+$/); }).css('text-align','right'); This will match "123", "12 3", "12.3" and "12,3" but not "abc", "abc123", etc....
I found this snippet of code from a similar question. :focus { outline: none; } and make sure that is underneath the other CSS styling for the element, I believe...
I solved this with a very simple custom layout which adds the name of the template in the first div. On your main template: <head> <title>Your title</title> ... </head> <template...
You're missing the Marker Object. For the Label you can use maplabel.js function initialize() { var mapCanvas = document.getElementById('map'); var mapOptions = { center: new google.maps.LatLng(58.393584, 15.566656), zoom: 17, mapTypeId:...
Scene Builder needs to know about the font as well. Notice that as well as you need to install the font on your application to make it work, you'll need...
Answer: http://jsfiddle.net/morrison/99LhB/ Notes: Click-boxes will be messed up on diagonals. I just realized that this will always be the case. I'd decrease the width of the arrow if I were...
jQuery UI supplies a neat callback for when it's done creating the element. That's where you'd want to do the color change. $( ".selector" ).button({ create: function(event, ui) { $('.selector').css({'background-color':...
Is this what you are trying to achieve? http://codepen.io/anon/pen/WoGXeM <!DOCTYPE html> <head> <title>dropdown list</title> <style> .dropbtn { background-color: #4CAF50; color: white; padding: 16px; font-size: 16px; border: none; cursor: pointer; }...
The item avatar has a default max-width and max-height property. You can find it in the ionic.css file. You can either change it over there or in your CSS just...
The text is centered, just the table doesn't fill the width of its enclosing area: table.t_group_matches {width:100%} ...
Just add a vertical-align property to your div with a value of "top" div { display: table-cell; background-color: #7cbaf4; padding: 0 20px; vertical-align:top; } div { display: table-cell; background-color: #7cbaf4;...
Use an @external @-rule to disable obfuscation for the given CSS class names: http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#External_and_legacy_scopes You can, for instance, put the following in any CssResource stylesheet: @external .gwt-*; But IMO, the...
Change your css for img like this .img-loader{ text-align: center; width: 50px; display: block; position:absolute; left:0; right:0; top:0; bottom:0; margin:auto; } .img-loader{ text-align: center; width: 50px; display: block; position:absolute; left:0;...
.subMenu li a { background: none; } if it is not sticking, you can add the !important flag .subMenu li a { background: none !important; } ...
There are multiple ways to achieve this, one would be to create an active state class for your favourite buttons and have this use the same styles as .fav:hover. Then...
Set the <router-view to have display: flex, and set flex:1 for the #make-full-height. This way #make-full-height will fill it's container since there are no other children. .full-screen { height: 100vh;...
To control this kind of resize events use @media CSS rule @media only screen and (min-width: 700px) { // CSS style for +700px } @media only screen and (max-width: 700px)...
You can target the input type number this way: .contact_form input[type="number"]:required And then adjust the asterix position. .contact_form input[type="number"]:required { background: #fff url(../image/product/none/red_asterisk.png) no-repeat 96% center; } ...
Flexible box technique is apt for the problem. Set the parent container to be the flexible box. Target the left and right elements to have a fixed width using flex:...
You can use the filter option: $('td').filter(function() { return this.innerHTML.match(/^[0-9\s\.,]+$/); }).css('text-align','right'); This will match "123", "12 3", "12.3" and "12,3" but not "abc", "abc123", etc....
I found this snippet of code from a similar question. :focus { outline: none; } and make sure that is underneath the other CSS styling for the element, I believe...
I solved this with a very simple custom layout which adds the name of the template in the first div. On your main template: <head> <title>Your title</title> ... </head> <template...
You're missing the Marker Object. For the Label you can use maplabel.js function initialize() { var mapCanvas = document.getElementById('map'); var mapOptions = { center: new google.maps.LatLng(58.393584, 15.566656), zoom: 17, mapTypeId:...
Scene Builder needs to know about the font as well. Notice that as well as you need to install the font on your application to make it work, you'll need...
Answer: http://jsfiddle.net/morrison/99LhB/ Notes: Click-boxes will be messed up on diagonals. I just realized that this will always be the case. I'd decrease the width of the arrow if I were...
jQuery UI supplies a neat callback for when it's done creating the element. That's where you'd want to do the color change. $( ".selector" ).button({ create: function(event, ui) { $('.selector').css({'background-color':...
Is this what you are trying to achieve? http://codepen.io/anon/pen/WoGXeM <!DOCTYPE html> <head> <title>dropdown list</title> <style> .dropbtn { background-color: #4CAF50; color: white; padding: 16px; font-size: 16px; border: none; cursor: pointer; }...
The item avatar has a default max-width and max-height property. You can find it in the ionic.css file. You can either change it over there or in your CSS just...
The text is centered, just the table doesn't fill the width of its enclosing area: table.t_group_matches {width:100%} ...
Just add a vertical-align property to your div with a value of "top" div { display: table-cell; background-color: #7cbaf4; padding: 0 20px; vertical-align:top; } div { display: table-cell; background-color: #7cbaf4;...
Use an @external @-rule to disable obfuscation for the given CSS class names: http://code.google.com/webtoolkit/doc/latest/DevGuideClientBundle.html#External_and_legacy_scopes You can, for instance, put the following in any CssResource stylesheet: @external .gwt-*; But IMO, the...
Change your css for img like this .img-loader{ text-align: center; width: 50px; display: block; position:absolute; left:0; right:0; top:0; bottom:0; margin:auto; } .img-loader{ text-align: center; width: 50px; display: block; position:absolute; left:0;...
.subMenu li a { background: none; } if it is not sticking, you can add the !important flag .subMenu li a { background: none !important; } ...
There are multiple ways to achieve this, one would be to create an active state class for your favourite buttons and have this use the same styles as .fav:hover. Then...
Set the <router-view to have display: flex, and set flex:1 for the #make-full-height. This way #make-full-height will fill it's container since there are no other children. .full-screen { height: 100vh;...
To control this kind of resize events use @media CSS rule @media only screen and (min-width: 700px) { // CSS style for +700px } @media only screen and (max-width: 700px)...
You can target the input type number this way: .contact_form input[type="number"]:required And then adjust the asterix position. .contact_form input[type="number"]:required { background: #fff url(../image/product/none/red_asterisk.png) no-repeat 96% center; } ...
Flexible box technique is apt for the problem. Set the parent container to be the flexible box. Target the left and right elements to have a fixed width using flex:...