Home arrow Style Sheets arrow Page 6 - CSS: Text, Fonts, and Tables
STYLE SHEETS

CSS: Text, Fonts, and Tables


We last left off discussing text in CSS. In this article we will finish this discussion, and cover how to manipulate fonts as well. And if time permits, we will also go over tables in CSS. It's a lot of ground to cover, so let's jump right in.

Author Info:
By: James Payne
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
March 17, 2008
TABLE OF CONTENTS:
  1. · CSS: Text, Fonts, and Tables
  2. · Word Wrapping
  3. · Adjusting Your Font Size
  4. · Fonting with Style
  5. · How to Set the Boldness of a Font
  6. · Tables in CSS

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
CSS: Text, Fonts, and Tables - Tables in CSS
(Page 6 of 6 )

Just like everything else, you can adjust tables in CSS as well. In our first example, we will learn to work with table layouts. There are two ways to set the table-layout property: fixed and auto.


<html>

<head>

<style type="text/css">

table.sampleone

{

table-layout: auto

}

table.sampletwo

{

table-layout: fixed

}

</style>

</head>

<body>

<table class="sampleone" border="1" width="100%">

<tr>

<td width="20%">Weeeeeeeeeeeeeeeeeeeeeeeeee here is a bunch of text</td>

<td width="30%">And some more</td>

<td width="40%">And even more!</td>

</tr>

</table>

<br />

<table class="sampletwo" border="1" width="100%">

<tr>

<td width="20%">You can't see all of this hahahahahahahahahahaha</td>

<td width="40%">Look even more text</td>

<td width="40%">And some more!</td>

</tr>

</table>

</body>

</html>

Showing Empty Cells in CSS

If you wish to show an empty cell in a table you can do so using empty-cells: show. Here it is in all its action-packed glory:


<html>

<head>

<style type="text/css">

table

{

border-collapse: separate;

empty-cells: show

}

</style>

</head>

<body>

<table border="1">

<tr>

<td>I</td>

<td>Heart</td>

</tr>

<tr>

<td>Huckabees</td>

<td></td>

</tr>

</table>

</body>

</html>

Setting Collapsed and Detached Borders

Here we will demonstrate how to set both Collapsed and Detached borders in a table:


<html>

<head>

<style type="text/css">

table.collapse

{

border-collapse: collapse

}

table.separate

{

border-collapse: separate

}

</style>

</head>

<body>

<table class="collapse" border="1">

<tr>

<td>Hugh</td>

<td>Jass</td>

</tr>

<tr>

<td>Al</td>

<td>Coholic</td>

</tr>

</table>

<br />

<table class="separate" border="1">

<tr>

<td>Pumper</td>

<td>Nickle</td>

</tr>

<tr>

<td>Rye</td>

<td>Toast</td>

</tr>

</table>

</body>

</html>

Conclusion

Well that's all the time we have for this episode. We still have a few more things to discuss regarding tables, but we will cover those in a future article. I hope you enjoyed the article and I'll see you soon.

Till then...


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
STYLE SHEETS ARTICLES

- CSS Combinators: Working with Child Combinat...
- CSS Combinators: Using General Siblings
- Intro to CSS Combinators
- CSS Semicircles and Web Page Headers
- Drawing Circular Shapes with CSS3 and Border...
- More CSS Pagination Link Templates
- CSS Pagination Links
- Animated CSS3 Image Gallery: Advanced Transi...
- CSS3 Animated Image Gallery: Transitions
- CSS3 Properties: Fixed Heights with box-sizi...
- CSS3 Properties: Altering Strokes and 3D Eff...
- CSS3 Properties: Text-Stroke
- CSS3 Transitions: Width and Height Properties
- Creating a Drop Down Menu in CSS3
- Intro to CSS Transitions

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 7 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials