Tuesday, April 16, 2013

Styling lists, links, tables, forms, & Floats and clearing

Last week we dived deeper into CSS by starting off with styling lists and links. With the lists, we learned how to make ordered and unordered lists with margins around them. We could also change the weight of the font and other aspects in order make the lists visually appealing. Another important aspect was that of the nested lists and how it should be indented within the code in order to better understand the relationship.
"When you create your CSS you should be careful to maintain clear design cues to show the relationship between a nested list and the list that contains it. By far the most common way to do this is by indenting the nested list items—it is in fact the default setting across the browsers."

Example:
<ol>
 <li>Chapter One
   <ol>
     <li>Section One</li>
     <li>Section Two </li>
     <li>Section Three </li>
   </ol>
 </li>
 <li>Chapter Two</li>
 <li>Chapter Three  </li>
</ol>
The indentations illustrate how the layout should be with the headings and subheadings. Another thing to consider was styling links. 
a {}
a:link {}
a:visited {}
a:focus {}
a:hover {}
a:active {}
By setting the style links accordingly, user can see that they're interacting with a link when they move their cursor over it and such. You can also apply text decoration and outlines to it.
The next thing we covered were tables and how to style them by adding captions, adjusting the size of the borders, the colors, and the padding and margins of the content being featured.
Next, we went over styling forms. The majority of CSS that is used for forms has already been covered and is applicable to setting up your preference for the forms you want to use. Some generic code for this would be:
body{
font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}
   
Finally, we went over floats and clearing. The biggest thing with floats is positioning your boxes and where you want them to be laid out. For example,
.box1{
            float: left;
            width: 50px;
            height: 50px;
            background-color: yellow;
            border: 2px solid black;
        }
As you can see, you can adjust the behavior of the float and whether you want it to float left or right. Next, you could adjust the weight and height in order to meet your specifications. You also control the background color and the color and weight of the font you want for your content. You also can set clearings so that the boxes clear your content if that is something that you would want. Clearing would allow the boxes to drop below the content to add a different stylistic look.
  

 

No comments:

Post a Comment