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.

Div's or Class ?

Featured Replies

When creating a Navigation Menu which ID selector should one, ID's or Class?

 

I am asking because I notice some use ' Class ' and others ' ID's ' .

 

Thank you

Edited by MartyBoi

When creating a Navigation Menu which ID selector should one, ID OR Class?

 

I am asking because I notice some use ' Class ' and others ' ID's ' .

 

Thank you

Well, for validation purposes, ID's can only be used once per page, where as classes can be used multiple times.

 

So, one may code a Menu in list form like this;

 

<ul id="main-nav">
<li class="main-nav-button">menu item 1</li>
<li class="main-nav-button">menu item 2</li>
<li class="main-nav-button">menu item 3</li>
<li class="main-nav-button">menu item 4</li>
</ul>

It's completely personal.

 

Some people advocate only using ID's. Other's think they are useless. Some use ID's for certain things only and others will chop and change on a whim.

 

As pointed out above the only difference between them is ID's have to be unique. Use them or don't use them. Doesn't make any difference.

Aim for classes wherever you can. It's a good idea to write your CSS aiming to get the result you want while using as little specificity as possible, to allow for future maintenance and more specific requirements to override it.

 

That doesn't mean yu shouldn't include IDs in your markup, they're absolutely vital as fragment identifiers (to link to a specific section of a page, for example).

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.