• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

Starting HTML and CSS ...

This is a short and made-easy tutorial on how to start HTML and CSS. It is intended for those who are just starting to know CSS and those who were not able to write one. It just shows how to create an HTML file, a CSS file and how to make them work together. The following are the steps:

View More Info

This is a short and made-easy tutorial on how to start HTML and CSS. It is intended for those who are just starting to know CSS and those who were not able to write one. It just shows how to create an HTML file, a CSS file and how to make them work together. The following are the steps:

Step 1: Creating the HTML file
Choose a plain text editor for your code (e.g. Notepad, TextEdit, etc.). You may use advanced tools and commercial programs such as Dreamweaver, Style Master and other. But as of the moment, a simple text editor will do fine. This is your first CSS style sheet, you might get confused with advanced features.

In a blank document, type in:

 <html>
<head>
<title>My first CSS</title>
</head>
<body>
<!– Site navigation menu –>
<ul class=”navbar”>
<li><a href=”index.html” mce_href=”index.html”>Home page</a>
<li><a href=”me.html” mce_href=”me.html”>My Life</a>
<li><a href=”town.html” mce_href=”town.html”>My Town</a>
<li><a href=”links.html” mce_href=”links.html”>Links</a>
</ul>
<!– Main content –>
<h1>My first CSS</h1>
<p>Welcome to my page!
<p>The contents are written here.
<p>More contents!
<!– Sign and date the page, it’s only polite! –>
<address>January 19, 2008<br>
by Me.</address>
</body>
</html>

*** The words within < and > are called HTML tags.
<html> - the document is enclosed in this tag
<head> - contains the <title> and saves a space for more information not shown on screen
<title> - shows the title of the document on the title bar of the browser
<body> - space where the contents is placed
<ul> - introduces unordered list
<li> - establishes numbered items
<– — > - enclosed comments; the browser ignores this
<p> - is for paragraph
<a> - means anchor for hyperlinks
<address> -

You may search in the web for more HTML tags and tutorials. Let’s just say that this is going to be one page site with a few similar pages. Just like a common Web page, this has a menu of links to other pages, a diffirent content and a signature.

Now save your document where you want to put it with a .html extension. Do not close the window yet since we will need it later. Open your web browser and click File > Open. Locate the html file and open it. Our html page should look like this:

Step 2: Adding color, fonts, navigation bar, links style and horizontal bar

Inside the <head>, right after the <title> tag, insert the following code:

<style type=”text/css”>
body {
padding-left: 11em;
font-family: Georgia, “Times New Roman”,
Times, serif;
color: purple;
background-color: #d8da3d }
ul.navbar {
list-style-type: none;
padding: 0;
margin: 0;
position: absolute;
top: 2em;
left: 1em;
width: 9em }
h1 {
font-family: Helvetica, Geneva, Arial,
SunSans-Regular, sans-serif }
ul.navbar li {
background: white;
margin: 0.5em 0;
padding: 0.3em;
border-right: 1em solid black }
ul.navbar a {
text-decoration: none }
a:link {
color: blue }
a:visited {
color: purple }
address {
margin-top: 1em;
padding-top: 1em;
border-top: thin dotted }
</style>

Style sheets are bounded by rules. Each rule has three parts:

1. The selector, which tells the browser which part of the document is affected by the rule;

2. The property, which specifies what aspect of the layout is being set; and

3. The value, which gives the value for the style property.

Example: body {background-color: #d8da3d }

Your styled page should look like this:



Step 3: Putting the CSS codes in a separate file

What we did was a page with an embedded style sheet. We will put it in a separate file. Your page may probably grow and would have several pages to share the same style.
Open your text editor and copy-paste code. Do not include the <style> tag, it belongs to the HTML.

body {padding-left: 11em;

font-family: Georgia, “Times New Roman”,

Times, serif;

color: purple;

background-color: #d8da3d }

ul.navbar {

list-style-type: none;

padding: 0;

margin: 0;

position: absolute;

top: 2em;

left: 1em;

width: 9em }

h1 {

font-family: Helvetica, Geneva, Arial,

SunSans-Regular, sans-serif }

ul.navbar li {

background: white;

margin: 0.5em 0;

padding: 0.3em;

border-right: 1em solid black }

ul.navbar a {

text-decoration: none }

a:link {

color: blue }

a:visited {

color: purple }

address {

margin-top: 1em;

padding-top: 1em;

border-top: thin dotted }Save it under a filename with a .css extension. Put it in a location where you want to save it.

Step 4: Putting them altogether

Now, we will remove all the style sheet code in our HTML file. Instead, insert the following code after the <title> tag:

 <html>
<head>
<title>My first styled page</title>
<link rel=”stylesheet” href=”mystyle.css”>
</head>
<body>
[etc.]

Last step is to put both files, html and css files on your Web site. Now you have a little background on how to do CSS.

source: css-faq

 View Full Story.
Posted at 09:59:02 am | Permalink | Posted in CSS  Html  

Related Stuff

  • MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.

  • Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone

  • TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support

  • ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.

  • Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.

  • Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software

  • PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.

Be the first ... |Add your comment.

Your Comment ...

  Name (required)

  Email (required, hidden)

  Website


About Ajaxlines

Ajaxlines is a project focused on providing its audience with a database of most of Ajax related articles, resources, tutorials and services from around the world.

Its purpose is to showcase the power of Ajax and to act as a portal to the Ajax development community.


Recent Stuff

CSS Animations via MooTools

JSON form builder

Using ASP.NET AJAX JSON Asynchronous Web Services

Growl for Windows and a Web Notification API

Learn AJAX from Scratch - Part II

Learn AJAX from Scratch - Part I


Our Partners

Ajax Projects

Web 2.0 Sites

Webloglines

Human Development Handbook

Software Development Company

Ajaxlines


Search


Topics

  • .Net (96)
  • Articles (76)
  • Bookmarking (35)
  • Calendar (18)
  • Chat (38)
  • ColdFusion (3)
  • CSS (31)
  • Email (23)
  • Flash (13)
  • Games (6)
  • Google (17)
  • Html (6)
  • Image (11)
  • International Calls & VOIP (7)
  • Java (34)
  • Javascript (146)
  • JSON (17)
  • Perl (2)
  • PHP (82)
  • Presentation (19)
  • Python (3)
  • Resources (1)
  • RSS (1)
  • Ruby (7)
  • Storage (4)
  • Toolkits (87)
  • Tutorials (190)
  • UI (11)
  • Utilities (161)
  • Web2.0 (13)
  • XmlHttpRequest (18)
  • YUI (4)

© 2006 www.ajaxlines.com. All Rights Reserved. Powered by IRange