14 Replies - 6472 Views - Last Post: 22 March 2011 - 09:10 PM

#1 thehollow89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 20-September 09

Basic CSS question

Posted 05 October 2009 - 11:50 AM

I have a question about the formatting of my code. I think I might be using the wrong order or commas when I am supposed to use semi-colons.

body {font-family:Verdana, Helvetica, sans-serif; margin:0px; background:repeat-y, white, body.jpg}
Is This A Good Question/Topic? 0
  • +

Replies To: Basic CSS question

#2 BetaWar  Icon User is online

  • #include "soul.h"
  • member icon

Reputation: 1155
  • View blog
  • Posts: 7,170
  • Joined: 07-September 06

Re: Basic CSS question

Posted 05 October 2009 - 11:59 AM

Background has no need for commas between the elements. The reason that the font-family needs commas between the font names is because it will look for the first one in the list, and if that exists it will stop looking, otherwise it will continue down the list until it finds one or runs out of the lsit to check for (if that makes sense).

The correct way to have that code is like so:
body {
  font-family:Verdana, Helvetica, sans-serif; 
  margin:0px; 
  background: url(body.jpg) repeat-y white;
}


Now, that has spacing to make is easier to read, but you could do it all on one line by just removing the line breaks I added.

Hope that helps.
Was This Post Helpful? 0
  • +
  • -

#3 bammurdo  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 62
  • Joined: 03-October 09

Re: Basic CSS question

Posted 05 October 2009 - 01:10 PM

ust to add on from what BetaWar said :

you don't HAVE to do it like this :

p {
	 color:red;
}



you CAN do it the way you want, but when you go back to reading it, it is much easyer to read :) (if you do it the spread out way).

Infact ... there's an artical about this somewhere ... lemme fish it out :)...

http://net.tutsplus....-for-beginners/

Number one on the list :).

:D Choose the "group" you find easyist :).

bam ;)
Was This Post Helpful? 0
  • +
  • -

#4 thehollow89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 20-September 09

Re: Basic CSS question

Posted 05 October 2009 - 03:55 PM

I have to apply this style to the address element:
Display the address only when both margins are clear of floating elements.
Was This Post Helpful? 0
  • +
  • -

#5 thehollow89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 20-September 09

Re: Basic CSS question

Posted 05 October 2009 - 04:00 PM

I have to apply this style to the address element:
Display the address only when both margins are clear of floating elements.
Was This Post Helpful? 0
  • +
  • -

#6 BetaWar  Icon User is online

  • #include "soul.h"
  • member icon

Reputation: 1155
  • View blog
  • Posts: 7,170
  • Joined: 07-September 06

Re: Basic CSS question

Posted 05 October 2009 - 04:01 PM

Please stop posting new threads on the same topic. Merged.
Was This Post Helpful? 0
  • +
  • -

#7 thehollow89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 20-September 09

Re: Basic CSS question

Posted 08 October 2009 - 11:08 PM

Hi, I have been instructed that I have to apply the following styles:
Display the address only when both margins are clear of floating elements.

I can't really find the relevant information in my text. Any help?
Was This Post Helpful? 0
  • +
  • -

#8 BetaWar  Icon User is online

  • #include "soul.h"
  • member icon

Reputation: 1155
  • View blog
  • Posts: 7,170
  • Joined: 07-September 06

Re: Basic CSS question

Posted 09 October 2009 - 07:20 AM

Typically we require people to post some code to show they have actually tried to do this, but I will just give you a few hints in the right direction.

Basically, you don't want the address tag to have anything floating left or right of it, that means that you should clear the sides first. I suggest checking out these sites for more information on what CSS can do:
www.w3schools.com
www.tizag.com
Was This Post Helpful? 0
  • +
  • -

#9 Guest_gemini*


Reputation:

Re: Basic CSS question

Posted 26 February 2010 - 10:40 PM

View Postthehollow89, on 08 October 2009 - 10:08 PM, said:

Hi, I have been instructed that I have to apply the following styles:
Display the address only when both margins are clear of floating elements.

I can't really find the relevant information in my text. Any help?



I am having the same problem... I can't figure out how to "Display the address only when both margins are clear of floating elements."

here is my code

#address {text-align: center; font-style: normal; font-size: 10pt; background-color: white; padding: 10px; border-style: solid; border-size: 1px; border-color: black; clear: both}
Was This Post Helpful? 0

#10 Guest_Jason45*


Reputation:

Re: Basic CSS question

Posted 16 April 2010 - 09:13 AM

I think you can find the solution at tizag, php tutorials or w3schools
Was This Post Helpful? 0

#11 Guest_Madz*


Reputation:

Re: Basic CSS question

Posted 03 May 2010 - 02:17 PM

View Postgemini, on 26 February 2010 - 09:40 PM, said:

View Postthehollow89, on 08 October 2009 - 10:08 PM, said:

Hi, I have been instructed that I have to apply the following styles:
Display the address only when both margins are clear of floating elements.

I can't really find the relevant information in my text. Any help?



I am having the same problem... I can't figure out how to "Display the address only when both margins are clear of floating elements."

here is my code

#address {text-align: center; font-style: normal; font-size: 10pt; background-color: white; padding: 10px; border-style: solid; border-size: 1px; border-color: black; clear: both}











I tried your code and without the '#' and it worked (finally) for me.
Was This Post Helpful? 0

#12 Guest_Madz*


Reputation:

Re: Basic CSS question

Posted 03 May 2010 - 02:25 PM

OK I tried it a bit more. This is what you posted

#address {text-align: center; font-style: normal; font-size: 10pt; background-color: white; padding: 10px; border-style: solid;
border-size: 1px; border-color: black; clear: both}
[/quote]

This is what I changed:

address {text-align: center; font-size: 10pt; font-style: normal; background-color: white; padding: 10px; border: 1px; border-style: solid; border-color: black; clear: both}
Was This Post Helpful? 0

#13 Guest_madz*


Reputation:

Re: Basic CSS question

Posted 03 May 2010 - 02:27 PM

I messed u p somewhere
this is what i have


address {text-align: center; font-size: 10pt; font-style: normal; background-color: white; padding: 10px; border: 1px; border-style: solid; border-color: black; clear: both}
Was This Post Helpful? 0

#14 revolutionx  Icon User is offline

  • D.I.C Head

Reputation: 60
  • View blog
  • Posts: 229
  • Joined: 23-July 09

Re: Basic CSS question

Posted 03 May 2010 - 03:09 PM

Can you post the full HTML of the page in code tags, so I can take a look at what you're actually trying to style.

Also instead of

border: 1px; border-style: solid; border-color: black; 


you can just do

border: 1px solid black; 


It's a lot quicker, it also works on all things that have 4 sides, like padding, margin, borders etc.

so
margin:10px 5px 6px 8px;


And the order is Top, Right, Bottom then Left.

Finally.

.address is for a class called address
and #address would be for an ID - You should only have 1 ID with the same name, but you can have multiple classes with the same name for different IDs.

and just reference them by

#anID .someClass {}
#AnotherID .someClass {}

This post has been edited by revolutionx: 03 May 2010 - 03:11 PM

Was This Post Helpful? 0
  • +
  • -

#15 mac10688  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 06-January 10

Re: Basic CSS question

Posted 22 March 2011 - 09:10 PM

This one is for my Dr. Singh peeps who stumble upon this!

The answer to your question:
I am having the same problem... I can't figure out how to "Display the address only when both margins are clear of floating elements."

is....

clear: both
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1