Search DominoPower's 11,441 Lotus-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Twitter Feed Click here for the Twitter feed.
PROGRAMMING POWER
Keep lookin' good with Cascading Style Sheets
By Andrew Stuart

In my previous article, "Cascading Style Sheets make you look good," at http://www.dominopower.com/issues/issue200204/cascade001.html, we made a start on getting to know CSS (Cascading Style Sheets). This time, we'll continue this discussion by taking a look at both "embedded" Cascading Style Sheets and "linked" Cascading Style Sheets.

Previously, by using the STYLE attribute we were able to control the appearance of individual HTML page elements without using any Javascript or other code. Using the STYLE attribute means that you're including the specific style properties and values into the actual HTML tags themselves. This is called "inline" cascading style sheets.

Inline CSS is useful and quick, and it's great for fine-tuning the appearance of specific individual page elements. On the downside, it can be repetitive and difficult to maintain, and all those CSS properties can make your HTML code messy and difficult to understand at a glance. The other problem with inline CSS is that making changes often means going through all your code and finding all the places that you've used the STYLE attribute and editing them individually. Inline CSS doesn't facilitate global changes.

Embedded CSS is more flexible than inline CSS. Embedded CSS allows you to define a set of CSS "rules" which can be used throughout the HTML page. The CSS rules are gathered together into a single place--in between a pair of <STYLE> tags located inside the <HEAD> block at the start of the page.

Here's an example of an embedded style sheet:

<head>
<style>
.myrule {
font: 23px Verdana, Geneva, Arial, Helvetica, sans-serif;
color : green;
font-weight:bold }
#anotherrule {
font: 10pt Arial, Helvetica, sans-serif;
color : black;
font-weight:italic }

</style>
</head>

<p class='myrule'>the first test</p>
<p id='anotherrule'>another test</p>

Rule structure
In order to understand Cascading Style Sheets, you need to understand CSS rules and the structure of those rules. The above example contains two rules, contained within the <STYLE> tags. Each rule starts with a "selector". The selectors in this example are named "myrule" and "anotherrule".

After the selector comes as many specific style declarations and values as you choose, separated by semicolons. A final curly bracket completes the rule.


1  ·  2  ·  3  ·  Next »
Other articles you might like
Home > Internet Technologies > HTML and CSS (15 articles)
   Using a reusable code approach to HTML select option lists
   One reader's opinion on HTML mailing
   Cascading Style Sheets make you look good
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Recent DominoPower Articles
Application development, William Shatner, and the origin of the universe
Learn Domino Designer 8.5 for free
The (near) future of Sametime, Quickr, Connections, and Symphony
Inside the IBM Innovations lab
Lotusphere 2010: Hot fixes and cool news for Notes, Domino, and LotusLive
Lotusphere 2010: mobility and collaboration
2010: A Lotusphere of change
Latest Lotus Headlines
Xpages not loading? JVM errors? - Solution
How to implement an iCalendar feed into your Notes calendar with XPages
DWA Hotfixes for Domino 8.5.1FP1 - A Gotcha
IBM Adds DB2 to Lotus Foundations SMB Package
SNTT : XPages onclick Ghosts in the machine
Ports used by Lotus Sametime 8.5 servers
Exploring a Domino Date Bug
>> Read all the news
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
OutlookPower: More about disappearing text
-- Advertisement --

Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.

The many included activities and demos will make you a pro! Expert instructor help is a click away.

Click here to try a FREE demo course!!

-- Advertisement --

Mark your calendar for in-depth Lotus training, May 12-14, Boston
Join experts and peers May 12-14 in Boston for educational and networking events that deliver real-world Lotus training so you can increase productivity and efficiency in your company, advance your skills, and squeeze the most from your current environment. One registration gets you into THE VIEW's Admin2010 and Lotus Developer2010.

Register by April 10 to save $200.
ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login