Killersites.com Homepage Welcome Guest   |   Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | User List  | Help


Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 6
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 28353 times and has 5 replies Next Thread
Female Susie
Advanced Member
Member's Avatar

Ohio, USA
Joined: May 30, 2004
Post Count: 2677
Status: Offline
Reply to this Post  Reply with Quote 
HTML and CSS FAQs

Questions relating to HTML, XHTML, CSS and web page layout.

Contents:
Should I use a DIV or TABLE?
How do I change the style of a link?
How do I center a web page in the browser window?
Checking Your Code For Errors
Relative & Absolute Positioning Explained
----------------------------------------
[Edit 5 times, last edit by tpattison at Mar 16, 2007 2:49:05 PM]
[Jun 3, 2006 8:04:54 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Female Susie
Advanced Member
Member's Avatar

Ohio, USA
Joined: May 30, 2004
Post Count: 2677
Status: Offline
Reply to this Post  Reply with Quote 
Re: Should I use a DIV or TABLE?

Questions relating to the use of DIVs and TABLES.


KS Forum Links:

Divs vs. Tables

Another Divs vs. Tables

Table or not to Table

Blah dl, it's a table!
[Jun 4, 2006 9:32:49 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male tpattison
Advanced Member
Member's Avatar

UK
Joined: Dec 29, 2004
Post Count: 1662
Status: Offline
Reply to this Post  Reply with Quote 
How do I change the style of a link?

This includes the use of a:link, a:visited, a:focus, a:hover, a:active, and using CSS to swap images.

KS Forum Links:

Hover effects:

CSS and link hover - Background image change upon link hover.

Create link roll-over effects without images

Links without the underline

Link hints/tooltips


About link pseudo classes:

a:focus - What does this do?

Help with coding css correctly for tab focus or active

General link styling


Bugs and glitches:

Link Hover Issue - In IE, the hover effect flashes briefly, but does not stay "lit" while the cursor is on the field. In Opera and FF only the text changes color, but not the background.

Content shift on a:hover in IE

Hover state not working on visited links

Thumbnails misplaced until you hover over them
----------------------------------------
Pavonis Mons | Listen of the week: "Residue of Desire" by Acumen
[Jun 9, 2006 8:25:59 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male tpattison
Advanced Member
Member's Avatar

UK
Joined: Dec 29, 2004
Post Count: 1662
Status: Offline
Reply to this Post  Reply with Quote 
How do I center a web page in the browser window?

In your CSS, add text-align:center; to body {} and margin:0 auto; to #container {}. For example:

body {
text-align:center;
}

#container {
margin: 0 auto;
}

Then place everything to be centered in a <div> and place this in your html file right after the <body> tag:

<div id="container">
Page's HTML goes here...
</div>

The </div> should be just before the </body> tag.
(Adapted from this post)

Quote LSW:
To center anything in CSS you use text-align (poor choice of names as it works for elements too). So the first thing you need to do in your CSS is to say anything in the body is to be aligned center -
text-align: center;

Then you want to say that the containing element should align itself equally in that container. For this you do as Thelma suggested and use
margin: 0 auto;

What you have done there is told the browser that the containing element (#container) should have no margin top or bottom (that is the "0". If you use one number it is all sides. 2 numbers - the first number is top/bottom & second number is right/left. 4 numbers in order are Top/Right/Bottom/Left) and auto means a automatic margin left & right. the wider the screen bexond the container, automatically more margin. Narrow dead space beyond the container gives automatically less margin. This then keeps the container centered.



More Forum Links:
Absolute positioning problems
Misc page centering
----------------------------------------
Pavonis Mons | Listen of the week: "Residue of Desire" by Acumen
[Aug 28, 2006 8:04:12 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male billyboy
Advanced Member
Member's Avatar


Joined: Sep 3, 2005
Post Count: 2206
Status: Offline
Reply to this Post  Reply with Quote 
Re: HTML and CSS FAQs

Checking Your Code For Errors

Often in the forum someone will post a request for help because something isn't displaying properly. Fixing coding errors first could save you and the people you are requesting help from a lot of time and trouble. While it is no guarantee that any display issues will be resolved, it is the first step that should be taken when there are problems, and valid code will help ensure your site displays consistently in all browsers.

Online validators offer a quick and easy way to check your code.

The W3C Validators can validate files uploaded from your computer, or online, or by copying and pasting the code.

W3C Markup Validation Service

W3C CSS Validation Service

The WDG HTML Validator also works via upload, direct input or online and has the option of validating the code for an entire site.

You can also check your CSS with WDG CSS Check via upload, or via direct input or online.

There is also an extension available for Firefox: Html Validator that shows errors and warnings when you view the source code of a web page. And Firefox's Web Developer Toolbar has menu options for validating (x)html and CSS via the W3C Validators.

Edit: There is also the Web Accessibility Toolbar (WAT) which is much like the Firefox Web Developer extention that is available for IE as well as Opera. LSW
----------------------------------------
Quiquid latine dictum sit altum viditur
----------------------------------------
[Edit 1 times, last edit by LSW at Jul 11, 2007 1:42:01 PM]
[Sep 22, 2006 7:13:47 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Female Susie
Advanced Member
Member's Avatar

Ohio, USA
Joined: May 30, 2004
Post Count: 2677
Status: Offline
Reply to this Post  Reply with Quote 
Relative & Absolute Positioning Explained

Original thread:
Relative & Absolute Positioning Explained
Padding/margins and positioning are really two completely different things.

Consider the CSS Box Model where you've got your content surrounded by padding, then the border, then the edge of the box, then margins outside the box.

When you adjust the padding, you're adding more space between the content and the outside of the box. The edge of the box need to expand to accommodate that extra space. The content remains the same. (Except in all versions of IE5 for Windows which does it the other way around. The box remains the same and the content shrinks)

If the top, left corner of the box was sitting 10px from the top, left of the window before adding padding, the top, left corner of the box would still be sitting 10px from the top, left of the window after adding padding. But because the size of the box has increased, the content - what you are actually seeing - is going to farther away from the corner. Hence it appears you have moved something, but you're haven't really, just changed the dimensions of the box.

With positioning, on the other hand, you are actually moving the box.

When you move it with relative positioning, you're using the original location of the box as a reference and moving it relative to that. So if you were to specify position: relative; top: 10px; left: 10px; the top left corner of the box is now going to be 10px down and to the left from where it would have been if you had left it alone. (You could also use bottom or right as references.)

But - this is where it gets funky - even after you've moved the box with relative positioning, the space where it used to sit is still occupied. Think of it as a ghost of the box staying behind and taking up room. Nothing can go there without forcing it because the 'ghost box' is in the way. Other boxes around it act as if it was still there. However the box takes up no space in it's new location. Other boxes can sit in the same spot. Anything around it ignores it in it's new location.

When you move the box with absolute positioning, you're placing it in new location using co-ordinates you define. It's new spot is an absolute location defined by those co-ordinates. Where the box used to sit has no bearing. The co-ordinates and the box's new location use the edge of the window by default as a reference. However if the box were sitting inside another box, and that outer box has been positioned, then the co-ordinates and the box's location use the edges of the outer box as a reference.

A box that has been moved with absolute positioning no longer occupies any space anywhere, either in it's new location, or in it's old location. Think of it as being ripped out of this dimension and existing in another. As soon as absolute positioning is applied - poof! its gone. But we can still see it. Other boxes around will behave as if it doesn't exist and never did. They will quite happily move into whatever space it used to take up and co-exist with it in it's new location.


More on positioning:
BrainJar.com - CSS Positioning
----------------------------------------
[Edit 2 times, last edit by billyboy at Aug 7, 2007 11:33:13 AM]
[Mar 15, 2007 3:52:11 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread