មេរៀនទី២០: លំហាត់ CSS-Browser និង Device
This div has a width of 200 pixels, padding of 20 pixels and a
border of 5 pixels.
#mybox {
padding: 20px;
border: 5px solid #000000;
background-color: #00BFFF;
width: 200px;
} លំហាត់ទី២ ធ្វើយ៉ាងណាដើម្បីបង្កើត print style sheet?

សរសេរកូដ
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
content=”text/html; charset=iso-8859-1″ />
title=”default” />
media=”print” />
Chinese style stuffed peppers
These stuffed peppers are lovely as a starter, or as a side
dish for a Chinese meal. They also go down well as part of a
buffet and even children seem to like them.
Ingredients
…
body, html {
margin: 0;
padding: 0;
}
#navigation {
width: 200px;
font: 90% Arial, Helvetica, sans-serif;
position: absolute;
top: 41px;
left: 0;
}
#navigation ul {
list-style: none;
margin: 0;
padding: 0;
border: none;
}
#navigation li {
border-bottom: 1px solid #ED9F9F;
margin: 0;
}
#navigation li a:link, #navigation li a:visited {
display: block;
padding: 5px 5px 5px 0.5em;
border-left: 12px solid #711515;
border-right: 1px solid #711515;
color: #ffffff;
background-color: #b51032;
text-decoration: none;
}
#navigation li a:hover {
color: #ffffff;
background-color: #711515;
}
#content {
margin-left: 260px;
margin-right: 60px;
}
#banner {
height: 40px;
background-color: #711515;
border-bottom: 1px solid #ED9F9F;
text-align: right;
padding-right: 20px;
margin-top: 0;
}
#banner ul {
margin: 0;
padding: 0;
}
#banner li {
display: inline;
}
#banner a:link, #banner a:visited {
font: 80% Arial, Helvetica, sans-serif;
color: #ffffff;
background-color: transparent;
}
#content p, #content li {
font: 80%/1.6em Arial, Helvetica, sans-serif;
}
#content p {
margin-left: 1.5em;
}
#content h1, #content h2 {
font: 140% Georgia, “Times New Roman”, Times, serif;
color: #B51032;
background-color: transparent;
}
#content h2 {
font: 120% Georgia, “Times New Roman”, Times, serif;
padding-bottom: 3px;
border-bottom: 1px dotted #ED9F9F;
}
body, html {
margin: 0;
padding: 0;
}
#navigation {
display: none;
}
#content {
margin-left: 20pt;
margin-right: 30pt;
}
#banner {
display: none;
}
#content p, #content li {
font: 12pt/20pt “Times New Roman”, Times, serif;
}
#content p {
margin-left: 20pt;
}
#content h1, #content h2 {
font: 16pt Georgia, “Times New Roman”, Times, serif;
color: #4b4b4b;
background-color: transparent;
}
#content h2 {
font: 14pt Georgia, “Times New Roman”, Times, serif;
padding-bottom: 2pt;
border-bottom: 1pt dotted #cccccc;
} លំហាត់ទី៣ អនុញ្ញាត browsers users ដើម្បីជ្រើសរើស style sheet

title=”default” />
media=”print” />
href=”largetext.css” title=”large text” />
body, html {
margin: 0;
padding: 0;
font-size: 140%;
}
#navigation {
width: 280px;
font: 90% Arial, Helvetica, sans-serif;
position: absolute;
top: 41px;
left: 0;
}
#navigation ul {
list-style: none;
margin: 0;
padding: 0;
border: none;
}
#navigation li {
border-bottom: 1px solid #ED9F9F;
margin: 0;
}
#navigation li a:link, #navigation li a:visited {
display: block;
padding: 5px 5px 5px 0.5em;
border-left: 12px solid #711515;
border-right: 1px solid #711515;
color: #ffffff;
background-color: #b51032;
text-decoration: none;
}
#navigation li a:hover {
color: #ffffff;
background-color: #711515;
}
#content {
margin-left: 320px;
margin-right: 60px;
}
#banner {
height: 40px;
background-color: #711515;
border-bottom: 1px solid #ED9F9F;
text-align: right;
padding-right: 20px;
margin-top: 0;
}
#banner ul {
margin: 0;
padding: 0;
}
#banner li {
display: inline;
}
#banner a:link, #banner a:visited {
font: 80% Arial, Helvetica, sans-serif;
color: #ffffff;
background-color: transparent;
}
#content p, #content li {
font: 80%/1.6em Arial, Helvetica, sans-serif;
}
#content p {
margin-left: 1.5em;
}
#content h1, #content h2 {
font: 140% Georgia, “Times New Roman”, Times, serif;
color: #B51032;
background-color: transparent;
}
#content h2 {
font: 120% Georgia, “Times New Roman”, Times, serif;
padding-bottom: 3px;
border-bottom: 1px dotted #ED9F9F;
}
លំហាត់ទី៤ អនុញ្ញាត browsers users ដើម្បី style sheet ប្តូរបាន

title=”default” />
media=”print” />
href=”largetext.css” title=”large text” />
/*
Paul Sowden’s JavaScript switcher as detailed on: http://www.alistapart.com/articles/alternate/
*/
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName(“link”)[i]); i++) {
if(a.getAttribute(“rel”).indexOf(“style”) != -1 &&
a.getAttribute(“title”)) {
a.disabled = true;
if(a.getAttribute(“title”) == title) a.disabled = false;
}
}
}
function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName(“link”)[i]); i++) {
if(a.getAttribute(“rel”).indexOf(“style”) != -1 &&
a.getAttribute(“title”) && !a.disabled)
return a.getAttribute(“title”);
}
return null;
}
function getPreferredStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName(“link”)[i]); i++) {
if(a.getAttribute(“rel”).indexOf(“style”) != -1
&& a.getAttribute(“rel”).indexOf(“alt”) == -1
&& a.getAttribute(“title”)
) return a.getAttribute(“title”);
}
return null;
}
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = “; expires=”+date.toGMTString();
}
else expires = “”;
document.cookie = name+”=”+value+expires+”; path=/”;
}
function readCookie(name) {
var nameEQ = name + “=”;
var ca = document.cookie.split(‘;’);
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==’ ‘) c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0)
return c.substring(nameEQ.length,c.length);
}
return null;
}
window.onload = function(e) {
var cookie = readCookie(“style”);
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
}
window.onunload = function(e) {
var title = getActiveStyleSheet();
createCookie(“style”, title, 365);
}
var cookie = readCookie(“style”);
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
Post a Comment