Jump to content

Help with CSS

Whether you're a seasoned veteran or a struggling beginner, Web Radiance is the web development and web design forum for you. You'll find answers to all your HTML, CSS, SEO, and Programming needs. Pull up a chair and stay awhile.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Help with CSS Rate Topic: -----

#1 User is offline   king213 

  • W.R. Private
  • Group: Members
  • Posts: 48
  • Joined: 18-January 07
  • Gender:Male
  • Location:Finedon, Northamptonshire, U.K

Posted 22 April 2007 - 10:36 AM

Hi. Can anyone clear-up what is possibly a very simple issue. Can you explain why CSS properties written by some designers are prefixed with a # symbol, whilst in other designers prefix theirs with a * symbol. Can I use any symbol I like to prefix a property, or will only certain ones work?
0

#2 User is offline   benbacardi 

  • Administrator
  • Group: Administrators
  • Posts: 1,140
  • Joined: 06-April 06
  • Gender:Male
  • Location:United Kingdom

Posted 22 April 2007 - 10:44 AM

The # is used to reference an ID used later on in the document.

I think the * is just an IE hack...

For example, if you have this html:

<div id="fish">

The CSS to reference it is #fish

If the HTML was this instead:

<div class="fish">

The CSS would be .fish not #fish.

Does that make sense?
0

#3 User is offline   king213 

  • W.R. Private
  • Group: Members
  • Posts: 48
  • Joined: 18-January 07
  • Gender:Male
  • Location:Finedon, Northamptonshire, U.K

Posted 22 April 2007 - 12:07 PM

Yes, that does make sense. Thankyou.

I read a lot about 'hacks'. What does this actually mean? Is it a sort of cheat, or a way to overcome some sort of problem with a specific browser. Are 'hacks' a good or bad thing? If I were to look at a specofic template designed by someone else, or a webpage/site etc. how would I know whether it is constructed using 'hacks'?
0

#4 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 22 April 2007 - 12:18 PM

View Postking213, on Apr 22 2007, 01:07 PM, said:

Yes, that does make sense. Thankyou.

I read a lot about 'hacks'. What does this actually mean? Is it a sort of cheat, or a way to overcome some sort of problem with a specific browser. Are 'hacks' a good or bad thing? If I were to look at a specofic template designed by someone else, or a webpage/site etc. how would I know whether it is constructed using 'hacks'?

Hacks take advantage of 'certain' browsers' inability to parse css like other browsers, and therefore allow you to aim some styles at one browser, and other styles at other browsers. It is, though, a lazy way of browser-filtering your css.

It's obvious that some browsers need different css properties than others, simply because they render css values differently. The default line-height, for example, is different in IE, than it is in Safari.

The best way to send some CSS to one browser, and other CSS to another browser, is through the use of conditional comments. They are for Internet Explorer (all versions, uniquely) only, because they tend to be the only browser(s) you need to send different css values too.

Read more about conditional comments here: http://www.quirksmod...ss/condcom.html
0

#5 User is offline   king213 

  • W.R. Private
  • Group: Members
  • Posts: 48
  • Joined: 18-January 07
  • Gender:Male
  • Location:Finedon, Northamptonshire, U.K

Posted 22 April 2007 - 12:22 PM

Thankyou for such a quick reply. I see what you mean, or at least I think I do. I'm going to take a look at the page you suggest and have a read-up on this.
0

#6 User is offline   Ryan Fait 

  • W.R. Sergeant
  • Group: Members
  • Posts: 204
  • Joined: 07-January 07
  • Location:Las Vegas

Posted 23 April 2007 - 04:57 AM

* isn't a hack, but it can be used with other code to be one.

* {
  margin: 0;
  padding: 0;
}


The above code sets the margin and padding on every element to zero. It's not a hack by any means.
The commercial front for my freelance web design company.
0

#7 User is offline   king213 

  • W.R. Private
  • Group: Members
  • Posts: 48
  • Joined: 18-January 07
  • Gender:Male
  • Location:Finedon, Northamptonshire, U.K

Posted 23 April 2007 - 09:26 AM

View PostRyan Fait, on Apr 23 2007, 10:57 AM, said:

* isn't a hack, but it can be used with other code to be one.

* {
  margin: 0;
  padding: 0;
}


The above code sets the margin and padding on every element to zero. It's not a hack by any means.



Hey, thanks for that too. I am learning a lot and have been studying up on the subjects. Will come back to you on this as the days unfold. Undoubtedly there are bound to be further related issues that don't make sense to a relative 'newbie' such as myself!!
0

#8 User is offline   marcamos 

  • W.R. General
  • Group: Administrators
  • Posts: 2,849
  • Joined: 04-April 06
  • Gender:Male
  • Location:Massachusetts - USA

Posted 23 April 2007 - 11:14 AM

I'm happy to know you're studying the right way to code front-end... the internet would be a better place if more people learned this stuff.
0

#9 User is offline   king213 

  • W.R. Private
  • Group: Members
  • Posts: 48
  • Joined: 18-January 07
  • Gender:Male
  • Location:Finedon, Northamptonshire, U.K

Posted 23 April 2007 - 12:58 PM

View Postherkalees, on Apr 23 2007, 05:14 PM, said:

I'm happy to know you're studying the right way to code front-end... the internet would be a better place if more people learned this stuff.


Well, as yet I'm certainly no expert, but given time I'd like to learn as much as possible about this subject, because it's very interesting. Problem is, there's never enough time! I don't expect that I'll ever know as much as you guys, in fact I can't begin to imagine how long you've been studying the subject to know as much as you do.

When it comes to building a website, or anything else for that matter, there is no point in doing half a job. It's the not knowing how to do certain things that really frustates me, and it's this frustration that motivates me to learn more. Eventually, hopefully, I will be the proud owner of a website/s that I built from the bottom up, using the correct methods.

Most of all, I'd like to say a great big thankyou to all of the members of this forum who have helped me so far. I'm certain that there will be many more questions over the coming weeks and months!!
0

#10 User is offline   moojoo 

  • Argh!
  • Group: Members
  • Posts: 449
  • Joined: 03-August 06
  • Location:Texas

Posted 15 May 2007 - 02:20 PM

To stray yet stay on topic,

You should not use hacks, instead you should use IE conditional comments.

<!--[if IE 6]>
<link rel="stylesheet" href="css/ie6.css" media="screen" type="text/css" />
<![endif]-->

<!--[if IE 7]>
<link rel="stylesheet" href="css/ie7.css" media="screen" type="text/css" />
<![endif]-->

Alterantely #is an ID which can only be used once per page and .Foo is a class which can be used as many times as you want.
Its not girly, its web 2.0!
0

#11 User is offline   TJSingleton 

  • Allegedly Legendary
  • Group: Members
  • Posts: 517
  • Joined: 31-July 06
  • Location:Winder, GA

Posted 16 May 2007 - 08:29 AM

The * is just a wildcard. And you can use it anywhere. For instance,

#content *

which will select everything underneath content.

* html

the ie hack works because the root element of the DOM is HTML. So how can the root element be a child of another element which is what

* html

would be. Anything that is the parent of the html. IE incorrectly applies this style.

Think of hacks as filters that allow you to filter out browsers who either do not understand the selector through a css deficiency, or where they incorrectly apply the selector. I'd have to concur that hacks should not be used in favor of conditional comments.
0

#12 User is offline   lwaxhaxnc 

  • W.R. Private
  • Group: Members
  • Posts: 14
  • Joined: 24-September 11

Posted 24 September 2011 - 01:19 PM

If I were to look at a specofic template designed by someone else, or a webpage/site etc. how would I know whether it is constructed using 'hacks'? :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users