Jump to content


CSS Help (Borders specifically)


6 replies to this topic

#1 Bengo

    Young Padawan

  • Members
  • Pip
  • 80 posts
  • Interests:Art, Graphic Design, Web Design

Posted 01 June 2007 - 04:05 AM

http://squeakyzoneproductions.com/AV/
It should be showing a 5 pixel border on the top, right and bottom sides, the color white, here's the CSS:
http://squeakyzonepr...udes/styles.css
I cannot figure this out, as you can tell, I've added and removed tons of things to try to fix it, Firefox isn't getting it and IE doesn't work for me. I'm a bit of a novice at CSS, so I'm assuming many of you stumbled onto this problem too.

#2 Jacorre

    P2L Jedi

  • Members
  • PipPipPip
  • 824 posts
  • Gender:Male
  • Location:USA
  • Interests:Computers, Technology, Internet, Graphic/Web Design, Music, Soccer

Posted 01 June 2007 - 09:15 AM

Make sure you define your borders top, right, bottom, left. I always think that I'll be in "TRouBLe" if I don't define them in the correct order!

#3 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 01 June 2007 - 02:40 PM

It looks to me like you used dreamweaver or some other WYSIWYG editor to make that CSS. That's never a good idea.

But my personal first rule of CSS, use shorthand when possible. Try this:
/* Aftervision Cascading Style Sheet (CSS) */
body
{
	background: #132121;
	vertical-align: top;
	text-align: left;
	margin: 20px 40px 0 0;
	font-family: arial;
	color: #132121;
	font-size: small;
}
img
{
	border: 0px;
}
a, a:link
{
	color: #132121;
	font-weight: bold;
	text-decoration: none;
}
a:active, a:visited:active
{
	color: #132121;
	font-weight: bold;
	text-decoration: none;
}
a:hover, a:visited:hover
{
	color: #132121;
	font-weight: bold;
	text-decoration: none;
}
a:visited
{
	color: #132121;
	font-weight: bold;
	text-decoration: none;
}
#header
{
	width: 900px;
	height: 89px;
	background: #31365a url('./images/banner.png') no-repeat top left;
	border-collapse: none;
	border-spacing: none;
	border: 5px solid #FFFFFF;
	border-width: 5px 5px 0 0;
}
#navigation
{
	width: 900px;
	height: 5px;
	background: #7192a9;
	border-right: 5px solid #FFFFFF;
}
#content
{
	width: 900px;
	text-align: left;
	vertical-align: top;
	background: #e3f3ef;
	border-right: 5px solid #FFFFFF;
}
#footer
{
	width: 900px;
	text-align: center;
	vertical-align: top;
	background: #7192a9;
	border: 5px solid #FFFFFF;
	border-width: 0 5px 5px 0;
}
The border appears fine in IE7, but not FF. Can't tell you why atm. You also had a few too many verticle-align's and text-align's in the body.

Edit: Bengo posted after i already loaded the page. Don't ask me what is different about his CSS though. I can't read non-shorthand to well.

Edited by rc69, 01 June 2007 - 02:42 PM.


#4 Bengo

    Young Padawan

  • Members
  • Pip
  • 80 posts
  • Interests:Art, Graphic Design, Web Design

Posted 01 June 2007 - 02:44 PM

View Postrc69, on Jun 1 2007, 07:40 PM, said:

The border appears fine in IE7, but not FF. Can't tell you why atm. You also had a few too many verticle-align's and text-align's in the body.
Yeah, it's been working in IE, but Firefox has done this to me before... Also, I type all that code by hand, aside from some things, I am using Dreamweaver but 95% of the coding is done by hand, I use Dreamweaver for previewing and thats about it.

Edit: I deleted the post I made after seeing his, all I did was organize the borders correctly like Jacorre said, didn't do anything though.

Edited by Bengo, 01 June 2007 - 02:47 PM.


#5 _*Creative Insanity_*

  • Guests

Posted 01 June 2007 - 02:57 PM

Totally agree with rc on that one.
For borders all around all you need is:

Say you want a black thin border around the entire site just do this:
#wrapper{
 border: 1px solid #000;
}

Placing just border, then that will effect all borders. If you are wondering why I have only 3 numbers for the colour then I will tell you.
Once again that is shorthand and it works like this:
When you have a byte of the same number like 00 00 00 you only need the first bit of that byte.
So that means that 00 00 00 would be 000 and ff ff ff would be fff and so one.

Also margins is another I see on many style sheets that put in full and you don't need to to.
Only need to do.
margin 23px 10px;
So that would give the top and botton a margin of 23px and left and right of 10px.
Margins in this manner work clock wise, IE: top, right, bottom and left. So for a different margin of all sides you just need do.
margin: 10px 23px 15px 8px;
Padding can be done in the same manner.
I cover this extensively on my site about dreamweaver.

#6 Bengo

    Young Padawan

  • Members
  • Pip
  • 80 posts
  • Interests:Art, Graphic Design, Web Design

Posted 01 June 2007 - 08:10 PM

Oh wait, it works now, awesome, thanks guys, you rule.
Another quick question, how do you uh.... give spacing to divs? Like instead of all my text being straight to the left and straight to the top, how would I put them 3 pixels apart from it?

Edited by Bengo, 02 June 2007 - 03:27 PM.


#7 _*Creative Insanity_*

  • Guests

Posted 02 June 2007 - 03:27 PM

Padding is inside and margin is outside.
So having a padding of 10px will place the content inside the div 10px.
A margin of 10px will move the div on the outside

Edited by Creative Insanity, 02 June 2007 - 03:28 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users