Category: CSS

Links to tutorials on HTML and CSS

By Leora Wenger, April 18, 2010 6:53 am

I put together this page of HTML and CSS tutorials a few years ago when I conducted a teen webmaster class at our library. The tutorials are still useful for those who would like to learn these essential web building tools. Click the image below to get to the page:

css and html links

Feel free to suggest more HTML or CSS links. If you are serious about learning to build websites, PHP, jQuery and how to set up and tweak any of the big three content management systems (WordPress, Drupal or Joomla!) are also key skills to master.

css html

Related Posts:

Popularity: 2% [?]

Fancy Colored Boxes with CSS

By Leora Wenger, December 3, 2009 11:40 am

If you like to play with colors, padding and borders, it’s easy to get boxes like these:

Fun Fancy Box
 

I use these boxes when I need to highlight some links or make a header stand out. One just has to get a hang of what the code should be, then one can tweak it for one’s own needs. You can use these at the top of a post or as a box to highlight links.

Learning the Code

Let’s take a look at the code for that top box. You will notice two div tags, one wrapped inside the other:

<div style=”padding:3px; border: 1px solid #ccc; background-color: #666;width: 400px; margin-left:auto; margin-right: auto;”><div style=”border: 1px solid #fff; background-color: #69c; padding: 5px;color: #fff; text-align:center; font-weight: bold; font-variant:small-caps;”>Fun Fancy Box</div></div>

The above is done with inline code. A better approach is to separate the HTML from the CSS – so it’s easier for you to see what is going on. You can then use the CSS code over and over again. And you will also discover that the two boxes have similar HTML markup:

<div class=”myouter”><div class=”myinner”>stuff here</div></div>

In the second box, the yellow with red borders, I inserted a <ul> tag with <li> links in the middle:

<div class=”myouter”><div class=”myinner”>
<ul>
<li><a href=”http://www.somedomain.com/link.htm”>Link One</a></li>
<li><a href=”http://www.somedomain.com/link2.htm”>Link Two</a></li>
<li><a href=”http://www.somedomain.com/link3.htm”>Link Three</a></li>
</ul>

</div></div>

The CSS Code

Here is the CSS code for the blue box, which you should save to your stylesheet (if you use WordPress, it’s styles.css):

/*CODE for FANCY COLORED BOXES (always good to comment your CSS code)
========================================================= */
.myouter {

padding:3px;
border: 1px solid #ccc;
background-color: #666;
width: 400px;
margin-left:auto;
margin-right: auto;

}

.myinner {

border: 1px solid #fff;
background-color: #69c;
padding: 5px;
color: #fff;
text-align:center;
font-weight: bold;
font-variant:small-caps;

}

The code for the red and yellow box with links is only a slight variation of the blue box. You will need to add some code for the ul and li tags:

/*CODE for FANCY COLORED BOXES (red and orangey yellow version)
========================================================= */
.myouter {

padding:3px;
background-color: #fff;
width: 400px;
padding:3px;
border: 1px solid #900;
margin-left:auto;
margin-right: auto;

}

.myinner {

border: 1px solid #900;
background-color: #ffcc66;
padding: 5px;
color: #900;
font-weight: bold;

}

.myinner ul {

margin-top: 5px;
margin-bottom: 5px;

}

.myinner ul li a{

color: #900;

}

.myinner ul li a:hover{

color: blue;
text-decoration:underline;

}

If you want both box versions in your stylesheet, name the classes for one of them something other than myinner and myouter.

Note: if you want this to work in your WordPress theme’s styles.css, you may have to put the post classes before the .myinner and .myouter to get this to work. This is what worked in my styles.css:

.post .entry .myouter {
…code here…
}
.post .entry .myinner {
…code here…
}

Curves: The Next Challenge

If you want to add curves, read some of these wonderful posts:

Need More Basic? Intro to CSS Links

flowered_boxes

put_an_image

Popularity: 12% [?]