Cascading Stylesheets
and how they work with HTML
body {
background-color: #e6e6e6;
color: #031B3F;
font-family: arial, helvetica, sans-serif;
padding:15px;
line-height:1.4em
}
Image credit: https://www.w3schools.com/css/css_syntax.asp
body {
background-color: #e6e6e6;
color: #031B3F;
font-family: arial, helvetica, sans-serif;
padding:15px;
line-height:1.4em
}
One CSS declaration per line: keep your code tidy and legible!
body {
background-color: #e6e6e6; /*#C5D3D3*/ /*#B4D6B4*/
/*trying different shades of grey-green */
color: #031B3F;
font-family: arial, helvetica, sans-serif;
padding:15px;
line-height:1.4em
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Webpage</title>
<style>
body {
background-color: #e6e6e6 /*#C5D3D3*/ /*#B4D6B4*/;
color: #031B3F;
font-family: arial, helvetica, sans-serif;
padding:15px;
line-height:1.4em
}
p { padding: 2em;
}
</style>
</head>
<body>
<p>..some text...</p>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Webpage</title>
<link rel="stylesheet" type="text/css" href="css/syllsched.css" />
</head>
<body>
<p>..some text...</p>
</body>
</html>
<head>
<title>My Portfolio Site</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
Reference: w3schools on CSS units
Favorite resources for ALL available CSS properties:
How to reference colors:
See w3C colors tutorial for more details.
See w3C colors tutorial for more details.
Combinations of CSS properties in declarations
body {
background-color:SlateBlue;
color: black;
}
h1 {
padding: 2px;
border: 1px solid violet;
}
<nav id="menu">
<div class="button"><a href="index.html">Home</a></div>
<div class="button"><a href="resume.html">Resume</a></div>
<div class="button"><a href="gallery.html">Gallery</a></div>
<div class="button"><a href="essays.html">DIGIT 100 Essays</a></div>
</nav>
nav#menu {padding:2vw; }
/* This means: style the <nav id="menu"> element. */
.button {
border:2px;
border-style:solid;
border-color:red;
padding:2vw;
background-color:#E6E6FA;
color:yellow;
width:10%;
display:inline;
border-radius: 20px;
}
/* This means: style ANY element that as an @class set to button, as in */
/* <li class="button"> or <p class="button"> or <div class="button">. */
<nav id="menu">
<div class="button"><a href="index.html">Home</a></div>
<div class="button"><a href="resume.html">Resume</a></div>
<div class="button"><a href="gallery.html">Gallery</a></div>
<div class="button"><a href="essays.html">DIGIT 100 Essays</a></div>
</nav>
#menu {padding:2vw; }
/* This means: style the <nav id="menu"> element. */
.button {
border:2px;
border-style:solid;
border-color:red;
padding:2vw;
background-color:#E6E6FA;
color:yellow;
width:10%;
display:inline;
border-radius: 20px;
}
/* This means: style ANY element that as an @class set to button, as in */
/* <li class="button"> or <p class="button"> or <div class="button">. */
# means @id, . means @class
<nav id="menu">
<div class="button"><a href="index.html">Home</a></div>
<div class="button"><a href="resume.html">Resume</a></div>
<div class="button"><a href="gallery.html">Gallery</a></div>
<div class="button"><a href="essays.html">DIGIT 100 Essays</a></div>
</nav>
#menu {padding:2vw; }
/* This means: style the <nav id="menu"> element. */
div.button {
border:2px;
border-style:solid;
border-color:red;
padding:2vw;
background-color:#E6E6FA;
color:yellow;
width:10%;
display:inline;
border-radius: 20px;
}
/* This means: style ANY element that as an @class set to button, as in */
/* <li class="button"> or <p class="button"> or <div class="button">. */
# means @id, . means @class