Jump to content
xisto Community
Sign in to follow this  
Borghunter

Simple Css Coding

Recommended Posts

Welcome to a short Step-by-Step CSS tutorial I have made:

Link to the CSS file in your HTML Document

<head><link href=stylesheet.css type=text/css rel=stylesheet></head>
Specify the object you want to use CSS in, for example, use the HTML "name" tag to create a variable, in this case we are going to use a text box

<input type=text name=text1>
Create the CSS document named "stylesheet.css"

Color the background, font and font-family of the HTML document

body {background-color: #000000;color: #FFFFFF;font-family: Arial, Verdana, Sans-Serif;}
Color the text box (Period indicates name variable),(input is the type of tag you are using)

input.text1 { background-color:transparent; border-top:0px; border-bottom:2px; border-right:0px; border-left:0px; border-color:#FFFFFF; border-style:dashed;}
Test it out and see what happens, it's pretty neat!

 

That is my short tutorial.

More info on tags and other stuff at http://forums.xisto.com/no_longer_exists/

Edited by Borghunter (see edit history)

Share this post


Link to post
Share on other sites

Styles can also be used in a case by case basis, if you want to change the attributes of one object. For example, to set the color, size and font of the text inside a div:

<div style="color:red; font:bold 15pt Arial Black;">Sample Text</div>

And to set the placement of a div relative to the top left corner of a document (50 pixels from the left and 100 pixels from the top):
<div style="position:absolute; left:50; top:100;">Sample Text</div>

Edited by smartbei (see edit history)

Share this post


Link to post
Share on other sites

FireFox, not IE.Please Make Sure You Read The Post Properly Before Responding!
FireFox version is currently 1.5

Don't construe your lack of understanding for me not reading properly. :lol:
What I meant is that all browsers since versions 4 of IE & Netscape (so, in other words, years ago) have been able to understand shorthand CSS. Your claim that it 'sometimes' works is wrong - I use it all the time and my sites check out fine in Firefox, IE5-7 (including IE5/Mac*), Mozilla, Netscape, Opera, Safari, Konqueror and Camino.
If you find it not working for you 100% of the time, you're doing something wrong.
Oh and smartbei, using inline styles is as bad as using font tags - CSS is intended to separate presentation from content, and by using inline style, you're just doing the opposite.

* The only browser I've come across that requires the long hand version of CSS is IE5/Mac when specifying left and right margins.

Share this post


Link to post
Share on other sites

Nice starters tutorial, though you use obsolete html:

<input type=text name=text1>

Attribute values must be properly quoted, like type="text"...

And all html tags must be closed:

<link href=stylesheet.css type=text/css rel=stylesheet>

Like this:

<link href="styleseeht.css" />


Share this post


Link to post
Share on other sites

Alright, so older html doctypes do not find this incorrect?Anyway i think we all agree that we must switch as fast as our posibilities allow us to xhtml and start producing a better markup.

Share this post


Link to post
Share on other sites

For HTML 4 doctypes, it's actually invalid to have the trailing /.As far as rushing towards XHTML, some would argue that using an HTML 4.0 strict doctype is probably better than using one with XHTML 1.0 and serving your pages as content type text/html rather than the intended application/xhtml+xml.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.