Saturday, November 26, 2011

CSS: Working with Text and Links


by eturo

Text

Formatting and adding style to text is a key issue for any web designer. In this lesson you will be introduced to the amazing opportunities CSS gives you to add layout to text. The following properties will be described:

¤  Text indention [text-indent]
The property text-indent allows you to add an elegant touch to text paragraphs by applying an indent to the first line of the paragraph. In the example below a 30px is applied to all text paragraphs marked with
:
           
            p {
                        text-indent: 30px;
            }
           
           
¤  Text alignment [text-align]
The CSS property text-align corresponds to the attribute align used in old versions of HTML. Text can either be aligned to the left, to the right or centred. In addition to this, the value justify will stretch each line so that both the right and left margins are straight. You know this layout from for example newspapers and magazines.

In the example below the text in table headings is aligned to the right while the table data are centred. In addition, normal text paragraphs are justified:
           
            th {
                        text-align: right;
            }

            td {
                        text-align: center;
            }

            p {
                        text-align: justify;
            }
           
           
¤  Text decoration [text-decoration]
The property text-decoration makes it is possible to add different "decorations" or "effects" to text. For example, you can underline the text, have a line through or above the text, etc. In the following example,

are underlined headlines,

are headlines with a line above the text and

are headlines with a line though the text.
           
            h1 {
                        text-decoration: underline;
            }

            h2 {
                        text-decoration: overline;
            }

            h3 {
                        text-decoration: line-through;
            }
           
           


¤  Letter space [letter-spacing]
The spacing between text characters can be specified using the property letter-spacing. The value of the property is simply the desired width. For example, if you want a spacing of 3px between the letters in a text paragraph
and 6px between letters in headlines

the code below could be used.
           
            h1 {
                        letter-spacing: 6px;
            }

            p {
                        letter-spacing: 3px;
            }
           
¤  Text transformation [text-transform]
The text-transform property controls the capitalization of a text. You can choose to capitalize, use uppercase or lowercase regardless of how the original text is looks in the HTML code.
An example could be the word "headline" which can be presented to the user as "HEADLINE" or "Headline". There are four possible values for text-transform:
o    capitalize
§  Capitalizes the first letter of each word. For example: "john doe" will be "John Doe".
o    uppercase
§  Converts all letters to uppercase. For example: "john doe" will be "JOHN DOE".
o    lowercase
§  Converts all letters to lowercase. For example: "JOHN DOE" will be "john doe".
o    none
§  No transformations - the text is presented as it appears in the HTML code.

As an example, we will use a list of names. The names are all marked with
  • (list-item). Let's say that we want names to be capitalized and headlines to be presented in uppercase letters.
    Try to take a look at the HTML code for this example and you will see that the text actually is in lowercase.
               
                h1 {
                            text-transform: uppercase;
                }

                li {
                            text-transform: capitalize;
                }

  • CSS: Working with Color, Backgrounds and Font

    by eturo


    Colors and Backgrounds

    In this lesson you will learn how to apply colors and background colors to your websites. We will also look at advanced methods to position and control background images. The following CSS properties will be explained:


    ¤  Foreground color: the 'color' property

    The color property describes the foreground color of an element. For example, imagine that we want all headlines in a document to be dark red. The headlines are all marked with the HTML element

    . The code below sets the color of

    elements to red.
               
                h1 {
                            color: #ff0000;
                }
               
    Colors can be entered as hexadecimal values as in the example above (#ff0000), or you can use the names of the colors ("red") or rgb-values (rgb(255,0,0)).

    ¤  The 'background-color' property

    The background-color property describes the background color of elements. The element contains all the content of an HTML document. Thus, to change the background color of an entire page, the background-color property should be applied to the element.

    You can also apply background colors to other elements including headlines and text. In the example below, different background colors are applied to and

    elements.
               
                body {
                            background-color: #FFCC66;
                }

                h1 {
                            color: #990000;
                            background-color: #FC9804;
                }
               
    Notice that we applied two properties to

    by dividing them by a semicolon.

    ¤  Background images [background-image]

    The CSS property background-image is used to insert a background image. As an example of a background image, we use the butterfly below.

    To insert the image of the butterfly as a background image for a web page, simply apply the background-image property to and specify the location of the image.
               
                body {
                            background-color: #FFCC66;
                            background-image: url("butterfly.gif");
                }

                h1 {
                            color: #990000;
                            background-color: #FC9804;
                }
               
               
    NB: Notice how we specified the location of the image as url("butterfly.gif"). This means that the image is located in the same folder as the style sheet. You can also refer to images in other folders using url("../images/butterfly.gif") or even on the Internet indicating the full address of the file: url("http://www.html.net/butterfly.gif").

    ¤  Repeat background image [background-repeat]

    In the example above, did you notice that by default the butterfly was repeated both horizontally and vertically to cover the entire screen? The property background-repeat controls this behaviour.

    The table below outlines the four different values for background-repeat.

    Value
    Description
    background-repeat: repeat-x
    The image is repeated horizontally
    background-repeat: repeat-y
    The image is repeated vertically
    background-repeat: repeat
    The image is repeated both horizontally and vertically
    background-repeat: no-repeat
    The image is not repeated

    For example, to avoid repetition of a background image the code should look like this:
               
                body {
                            background-color: #FFCC66;
                            background-image: url("butterfly.gif");
                            background-repeat: no-repeat;
                }

                h1 {
                            color: #990000;
                            background-color: #FC9804;
                }
               
               
    ¤  Lock background image [background-attachment]

    The property background-attachment specifies whether a background picture is fixed or scrolls along with the containing element. A fixed background image will not move with the text when a reader is scrolling the page, whereas an unlocked background image will scroll along with the text of the web page.

    The table below outlines the two different values for background-attachment. Click on the examples to see the difference between scroll and fixed.

    Value
    Description
    Background-attachment: scroll
    The image scrolls with the page - unlocked
    Background-attachment: fixed
    The image is locked

    For example, the code below will fix the background image.
               
                body {
                            background-color: #FFCC66;
                            background-image: url("butterfly.gif");
                            background-repeat: no-repeat;
                            background-attachment: fixed;
                }

                h1 {
                            color: #990000;
                            background-color: #FC9804;
                }
               
               
    ¤  Place background image [background-position]

    By default, a background image will be positioned in the top left corner of the screen. The property background-position allows you to change this default and position the background image anywhere you like on the screen.

    There are numerous ways to set the values of background-position. However, all of them are formatted as a set of coordinates. For example, the value '100px 200px' positions the background image 100px from the left side and 200px from the top of the browser window.

    The coordinates can be indicated as percentages of the browser window, fixed units (pixels, centimetres, etc.) or you can use the words top, bottom, center, left and right. The model below illustrates the system:



    The table below gives some examples.

    Value
    Description
    background-position: 2cm 2cm
    The image is positioned 2 cm from the left and 2 cm down the page
    background-position: 50% 25%
    The image is centrally positioned and one fourth down the page
    background-position: top right
    The image is positioned in the top-right corner of the page

    The code example below positions the background image in the bottom right corner:
               
                body {
                            background-color: #FFCC66;
                            background-image: url("butterfly.gif");
                            background-repeat: no-repeat;
                            background-attachment: fixed;
                            background-position: right bottom;
                }

                h1 {
                            color: #990000;
                            background-color: #FC9804;
                }
               
               
    ¤  Compiling [background]
    The property background is a short hand for all the background properties listed in this lesson.

    With background you can compress several properties and thereby write your style sheet in a shorter way which makes it easier to read.

    For example, look at these five lines:
               
                background-color: #FFCC66;
                background-image: url("butterfly.gif");
                background-repeat: no-repeat;
                background-attachment: fixed;
                background-position: right bottom;
               
               
    Using background the same result can be achieved in just one line of code:
               
                background: #FFCC66 url("butterfly.gif") no-repeat fixed right bottom;
               
               
    The list of order is as follows:

    [background-color] | [background-image] | [background-repeat] |
    [background-attachment] | [background-position]

    If a property is left out, it will automatically be set to its default value. For example, if background-attachment and background-position are taken out of the example:
               
                background: #FFCC66 url("butterfly.gif") no-repeat;
               
    These two properties that are not specified would merely be set to their default values which as you know are scroll and top left.

    Tutorial: Web-Based System Overview

    by eturo

    A website can be divided into pieces a lot of different ways. You can divide up the process of development into stages, or you can look at the individual parts. But a website is not like a car. The pieces don’t screw together or came apart in the same way. What makes a website work is the interaction between components that are separated in space and, possibly, time. Some of the pieces are more theoretical, such as the layout and the navigation structure. It’s like the frame of the car, except that you can’t actually see the frame.

    *      COMPONENTS OF A WEBSITE
    ¤  Front End Elements
    ¾     front end is what you see, back end is what you don’t
    ¾     front end elements includes the objects that composed the interface of the website

    ο   The Navigation Structure
    ·         is the order of the pages, the collection of what links to what
    ·         usually it is held together by at least one navigation menu
    ο   The page layout
    ·         this is the way things appear on the page
    o   Is the navigation menu on the top or along the side?
    o   Are there images above the text area? Tables?
    ·         good layout is as important as any other element of design
    ·         bad layout makes a website look crowded and slapdash
    ·         good layout allows the eye to find what it seeks easily
    ο   Logo
    ·         this graphic represents the company or an organization
    ·         it often sets up the color scheme and the style elements used throughout
    ·         it ties the website to everything else the company does
    ο   Images
    ·         this represents photos, graphics, navigation bars, lines and flourishes, animations that can all be placed on a website to bring it to life
    ο   Contents
    ·         this is usually the information which is broken into readable chunks used primarily to communicate to the viewer
    ·         it is formatted to be easily scanned, and it is often optimized for search engines as well as human eyes
    ο   Graphic Design
    ·         it is the overall look of the website as a result of proper use and integration of all the elements (logo, images, layout, navigations menus, etc…)

    ¤  Back End elements
    ¾     these refers to the functional elements of a website such as the following:


    o   modern sites are searchable
    o   some websites allow the user to request more information such as downloading, or to post their own thoughts such as forums, bulletins, threads, polls, etc…
    o   can be updated directly from a simple panel or word-processing program

    ¤  Content Management System (CMS)
    ¾     this is the ability to update your website without having to directly edit the HTML
    ¾     a robust content management system allows for documents to be prepared, edited, approved, and tracked prior to publication
    ¾     simple systems create areas on a web page that can be easily changed on a regular basis
    ¤  E-Commerce
    ο   this refers to the purchasing of items from the internet in a website
    ·         new levels of convenience are possible, such as mail-order rentals of DVDs and games
    ·         the simple ability to safely process credit-card transactions over the internet is where this process begins
    ¤  Shopping Cart
    ο   this is just a way for visitors to pick out different items and make a single purchase at the end of the process
    ·         if you have one or two products, it’s fine if visitors click a couple times, fill out information, and purchase the product
    ·         if you have a lot of different things for sale, you need a shopping cart
    ¤  Site Search
    ο   this is a part of a website where you can search information you want from that site
    ¤  Blog feature
    ο   blogs are much in the news these days
    ο   blogs can be done independently, or as part of your website
    ο   some content management systems have blog modules
    ο   specialized blogging software can be installed on your server, or you can use blogging services
    ¤  Image-rotation
    ο   presenting new images each time someone visits your page gives it a sense of life
    ·         photos can be rotated, as can pieces of text, such as quotes or service descriptions
    ¤  Chatroom
    ο   there are a number of ways to allow people to interact online
    ·         bulletin board allows people to post up messages on a topic
    ·         chatroom allows users to comment back and forth in real time
    ¤  Contact forms
    ο   most websites need some kind of contact form
    ·         even if you are just giving information away, you still might want people to thank you for it
    ·         whether the goal is commerce or political organizing, contact forms are a starting point for interaction
    ¤  Referral forms
    ο   viral marketing takes many forms
    ·         if someone likes your site, and has an easy, one-push way to notify her friends, you’ve turned your visitors into salespeople
    ¤  Newsletter registration
    ο   if you have the kind of content that is updated periodically, there are few better ways to build a regular readership than newsletters
    ·         newsletters keep you in front of potential clients, as well as keeping your current clients in the loop about your new products, services, or campaigns
    ·         the fastest way to build a legitimate newsletter mailing list is to allow people to choose in at your website
    ¤  Online databases
    ο   databases allow us to store, sort, search through, and display large amounts of information
    ·         online databases bring this technology seamlessly to the Web
    ¤  Password protected sections
    ο   the public area of your website is a great way to serve a variety of audiences
    ·         But what if you have a membership that deserves better, more comprehensive content?
    ·         Or what if you want certain registered visitors to be able to perform online actions?
    ο   this is a section of a website set aside for internal processes
    ·         this is easily done by creating password protected sections
    ¤  Downloadable files
    ο   this is an easy way to distribute files all over the world
    ·         from simple flyers to hundred page documents, e-books, music files, and even movie clips can be downloaded from websites
    ¤  Multi-media
    ο   this refers to photo-tours, video-clips, sound-clips that can add to a website if they are well matched to the type of site and profile of the target audience
    ¤  Security
    ο   all kinds of information can be found hidden on websites
    ·         trade secrets, proprietary programming, client credit card numbers, and every imaginable piece of personal data
    ο   if you are passing information online that is not meant for everyone, then you want to ensure you have the right level of security

    *   Other components
    ¾     some elements that are essential to a website aren’t properly described as either front-end or back-end components

    ¤  Hosting
    ο   it is where your website is physically located
    ·         on a server, or somewhere, are a set of files that are transmitted to user computers when they call your name
    ¤  Domain Name
    ο   it refers to the address of your website
    ·         when someone asks to see your website, they put this address into the internet, and your site is served up to them
    ¤  Online Promotion
    ο   not exactly part of the website, but often part of the design as well as the activity surrounding its launch is the online promotion
    ·         a site with no visitors is like a huge monument built in an uninhabited desert


    Like Us on Facebook

    Related Posts Plugin for WordPress, Blogger...