Search

Alves Singh

Category

CSS

Media Queries for Desktop, Tablet, Mobile

/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/

@media (min-width: 1281px) {

//CSS

}

/*
##Device = Laptops, Desktops
##Screen = B/w 1025px to 1280px
*/

@media (min-width: 1025px) and (max-width: 1280px) {

//CSS

}

/*
##Device = Tablets, Ipads (portrait)
##Screen = B/w 768px to 1024px
*/

@media (min-width: 768px) and (max-width: 1024px) {

//CSS

}

/*
##Device = Tablets, Ipads (landscape)
##Screen = B/w 768px to 1024px
*/

@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {

//CSS

}

/*
##Device = Low Resolution Tablets, Mobiles (Landscape)
##Screen = B/w 481px to 767px
*/

@media (min-width: 481px) and (max-width: 767px) {

//CSS

}

/*
##Device = Most of the Smartphones Mobiles (Portrait)
##Screen = B/w 320px to 479px
*/

@media (min-width: 320px) and (max-width: 480px) {

//CSS

}

@media (max-width: 319px){

//CSS

}

Css popup

CSS Popup

<!DOCTYPE html>

<html lang=”en”>

<head>

<meta charset=”utf-8″>

<title>HTML5/CSS3 Modal</title>

<!– Demo Styles –>

<link href=”css/demo.css” rel=”stylesheet”>

<!– Modal Styles –>

<link href=”css/modal.css” rel=”stylesheet”>

</head>

<body>

<div class=”container”>

<p><a href=”#modal” class=”btn go”>Activate Modal</a></p>

</div>

<div id=”modal”>

<div class=”modal-content”>

<div class=”header”>

<h2>Modal Heading</h2>

</div>

<div class=”copy”>

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

</div>

<div class=”cf footer”>

<a href=”#” class=”btn”>Close</a>

</div>

</div>

<div class=”overlay”></div>

</div>

</body>

</html>

<style type=”text/css”>

/* Normal styles for the modal */

#modal {

left:50%;

margin:-250px 0 0 -40%;

opacity: 0;

position:absolute;

top:-50%;

visibility: hidden;

width:80%;

box-shadow:0 3px 7px rgba(0,0,0,.25);

box-sizing:border-box;

transition: all 0.4s ease-in-out;

-moz-transition: all 0.4s ease-in-out;

-webkit-transition: all 0.4s ease-in-out;

}

/* Make the modal appear when targeted */

#modal:target {

opacity: 1;

top:50%;

visibility: visible;

}

#modal .header,#modal .footer {

border-bottom: 1px solid #e7e7e7;

border-radius: 5px 5px 0 0;

}

#modal .footer {

border:none;

border-top: 1px solid #e7e7e7;

border-radius: 0 0 5px 5px;

}

#modal h2 {

margin:0;

}

#modal .btn {

float:right;

}

#modal .copy,#modal .header, #modal .footer {

padding:15px;

}

.modal-content {

background: #f7f7f7;

position: relative;

z-index: 20;

border-radius:5px;

}

#modal .copy {

background: #fff;

}

#modal .overlay {

background-color: #000;

background: rgba(0,0,0,.5);

height: 100%;

left: 0;

position: fixed;

top: 0;

width: 100%;

z-index: 10;

}

</style>

Doenload here: css-popup

Add class into the body(browser specific)


$class = '';
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false) {
$class = "mac-chrome";
}
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
$class = "mac-firefox";
}
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') === false) {
$class = "mac-safari";
}
}
else if(strpos($_SERVER['HTTP_USER_AGENT'], 'Windows') !== false) {
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false) {
$class = "win-chrome";
}
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {
$class = "win-firefox";
}
if(strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') !== false && strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') === false) {
$class = "win-safari";
}
if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 8.0') !== false) {
$class.= " win-ie8";
} else if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 9.0') !== false) {
$class.= " win-ie9";
} else if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 10.0') !== false) {
$class.= " win-ie10";
}
}
?>

Responsive Menu

For using this script, download the attachment and rename the file remove the .doc extension then extract it and use it.

Download here: responsive-menu.zip

Flip CSS3

For using this script, download the attachment and rename the file remove the .doc extension then extract it and use it.

Download here: flip.zip

Blog at WordPress.com.

Up ↑