Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

css questions

Featured Replies

i just wanted to ask something about css, first off how come the body and other main tags dont need a "#" infront because when ever i use a new div in the css i use a # infront of the id but the body doesnt need this also i want to know what the "." infront of some names are?

 

thanks,

Have you noticed when you write a div you do this

 

<div id="style"></div>

 

well the # lets the css know that it is and id

 

 

you could also do this

 

<div class="style1"></div>

 

and to let the css know that it is a class you would us a "." instead of the # in the css.

 

So because body, h1, p, strong...ect are all html tags your css knows what they are, but if you make something up such as style72 it doesn't know what that is, so you help it by saying if it is an id (#) or a class (.), this makes it easy for both the css and html to know what it is and find what it is looking for :)

 

 

 

Now the reason why there are ids and classes is quite simple. An id is a unique identifier so in an html document you can only use it once, because it has to be unique to that page, if you wanted a lot of divs or things to be the same you wouldn't be able to use an id (#) you would use a class as a class can be used as many times as you need it on a page.

 

 

 

I hope that makes a bit of sense.

i just wanted to ask something about css, first off how come the body and other main tags dont need a "#" infront because when ever i use a new div in the css i use a # infront of the id but the body doesnt need this also i want to know what the "." infront of some names are?

 

thanks,

 

It's just how it's written, The hash (#) is used to determine an ID selector. Hence why you use it there, like everyone else! :D The reason you don't use it (#) with the main tags (such as body) is because they're not ID's, unlike the ID tags, which.....are :lol: .

As for the "." that is just an attribute that defines a class name that you specify.

E.g. .NavBarHolder

 

Au Revoir!

B.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.