how can a media query detect a full-hd smartphone?
Tags: css,responsive-design,media-queries
Problem :
If a media query checks to see the number of pixels on the device, How does it know between a desktop full hd monitor, and a full hd smartphone?
Obviously the design for both is very different (css-wise)..
Solution :
You do it by pixel density.
@media only screen (-moz-min-device-pixel-ratio: 2),
only screen and (-o-min-device-pixel-ratio: 2/1),
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2) {
/*This will be high ppi smart phone*/
}
CSS Howto..
Change top: 18px; to bottom: 18px; ...
Unfortunately there is no correct way to disable components through css, for this type of functionality is meant for javascript. The philosophy for most programmers that I have worked with...
CSS Flexbox can do it even if the height of the container isn't known/set explicitly: .container { width: 348px; /* random value to simulate being set by JavaScript */ border:...
Use this .main{ display:table; text-align:center; margin:0 auto; } .main .list{ text-align:left; display:table-cell; } ...
The fastest and most trouble-free solution was the analysis of http requests to the server and send the required data.
Use the same style for the normal and hover effect. That way the link will have the same style when you hover it, as when you don't. You don't disable...
local() tries to use the font when it is already installed on the user's computer. Font-weight defines the boldness of the font, font-style allows you to display your font in...
The problem is that you are using an external JS framework, AngularJS. You will have to create another script tag which loads Angular as well. There are two ways you...
You shouldn't. What if a user has styles turned off, or is using a screen reader? They should be able to take the survey as well. div{position:relative;} a {display:block; width:120px;...
You were almost there. You just need to add two lines of code: html, body { height: 100%; } Since you're using a percentage height in .contentBlock, you need to...
IE 5.5, 6, and 7 do not support the :focus css selector http://reference.sitepoint.com/css/pseudoclass-focus Add an id to your password input <input id="password" type="password" class="filterinputpassword clearField"> Add this in your head...
If there are spaces in the class attribute value, that means there are multiple classes applied to the element. To locate an element with multiple classes, the css selector is...
Here: http://jsfiddle.net/ubfLe/ Change the function setContent: function setContent(index) { $(".image").fadeOut("fast", function() { $(this).attr("src", images[index]); $(".title").html(titles[index]); $(".caption").html(subtitles[index]); $(".image").fadeIn("fast"); }); } ...
The problem was the tick marks I put around the properties and their values. When I removed them: $('.slick_slideshow1').slick({ accessibility: true, adaptiveHeight: true, centerMode: true, centerPadding: '0px', slidesPerRow: 3, slidesToShow:...
Unfortunately, with CSS only, you're not able to do it. You need to use JS. I am giving you a jQuery example - $(document).ready(function(){ $('input').addClass('disableHotkeys'); }); or $(document).ready(function(){ $('input').each(function(){ $(this).addClass('disableHotkeys');...
What you are looking to do is done by having a couple of themes on the server (theme1.css, theme2.css, theme3.css, etc.) and letting the user select the theme he likes....
This one should work: @supports (-ms-ime-align:auto) { .selector { property: value; } } For more see: Browser Strangeness...
In Wordpress jQuery is default with noConflict. You must change in your script all "$" to "jQuery". <script type="text/javascript" language="javascript"> function createCookie(name,value,days) { if (days) { var date = new...
Well, one way of doing it purely with CSS is by using the :after pseudo element. Check this fiddle: http://jsfiddle.net/4xgdv/ The original element is relative and its pseudo child is...
I'd recommend using an IFrame in conjunction with an Http Handler. <tr> <td colspan="4"> <iframe src="GetContent.ashx?id=<%=Id%>" style="border:0px;" height="500px" width="800px">Loading...</iframe> </td> </tr> In web.config, under HttpHandlers, you'd need to add a...
You don't need JavaScript to achieve this functionality. Use CSS media queries: @media only screen and (orientation : portrait) { /* Portrait styles */ } @media only screen and (orientation...
A quick media query should be enough. Add this after your CSS : @media screen and (max-width: 420px) { // adjust the width for your needs div.credits { display: none;...
button { background: @button-background; color: @text; .focus { background-image: linear-gradient(#79d858, #569e3d); border-color: #4a993e; color: white; &:hover { ... } } } NB: ampersand on focus is superfluous....
This will do it: input[type=text] Though it might not work in all browsers (e.g. IE). The only way to ensure that would be to add a class or put it...
Flexslider is pretty good for mobile. It has some custom functions for slide functionality and is responsive out-of-the-box. You can also do dynamic heights and looping by just setting some...
input[type=submit][value=Delete] You're chaining selectors. Each step narrows your search results: input finds all inputs. input[type=submit] narrows it to submits, while input[type=submit][value=Delete] narrows it to what you need....
http://jsfiddle.net/hxbB9/18/ another alternative solutiont that dosnt require setting a width on your .tags div .tags { } .tags li { display:inline-block; list-style-type: none; text-decoration: none; margin: 10px 0 0 0;...
You cant do that, however you can pass in 2 variables, one for the class and another for the color to the mixin.
When the DOM is finished loading you can add your code in the $(document).ready() function. Remove the onclick from here: <input type="submit" name="submit" value="Submit" onClick="PopUp()" /> Try this: $(document).ready(function(){ setTimeout(function(){...
There is nothing wrong with using relative paths with SSL pages, there must be something else involved. Have you considered any other logic you may have, an extra redirect with...