/    Sign up×
Community /Pin to ProfileBookmark

What’s this "selector" (#) mean ?

Very short message:
What does the selector (#) do?
Gracias a todos.

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelMay 18.2006 — Very short message:

What does the selector (#) do?

Gracias a todos.[/QUOTE]


That stands for "ID", so for instance, "#wrapper {foo}" means " ID="Wrapper" in the html.

There can only be one use of any particular "[B]id[/B]" in a web page. -Cannot be 'shared'. For values shared several/multiple times, you create a "[B]class[/B]", which in the Styles is "[B][SIZE=4].[/SIZE][/B]class_name {foo}" (note the period-dot before the classname). That way, if a several DIVs throughout the web page share the same declarations of color, line-height, font-weight, etc., they can draw this information from the shared "class".

Easy way to think of it, is "[I]ID[/I] is personal, there is only one" and "[I]class[/I] is like a classroom, there are many".

There is a reason why there are "ID"s and there are "CLASS"es instead of just one for all, -but I do not recall the reasoning. Just that it is so. ?
Copy linkTweet thisAlerts:
@stalepretzel59authorMay 22.2006 — so an # selector is just like a class... but instead of applying to anything with that class, it applies only to the object with a certain ID?

That seems pretty pointless...
Copy linkTweet thisAlerts:
@NogDogMay 22.2006 — From http://www.w3.org/TR/html4/struct/global.html#adef-id :
The id attribute has several roles in HTML:
[list]
  • [*] As a style sheet selector.

  • [*] As a target anchor for hypertext links.

  • [*] As a means to reference a particular element from a script.

  • [*] As the name of a declared OBJECT element.

  • [*] For general purpose processing by user agents (e.g. for identifying fields when extracting data from HTML pages into a database, translating HTML documents into other formats, etc.).
  • [/list]
    [/quote]
    ×

    Success!

    Help @stalepretzel59 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...