Elements not following CSS Type Class...

User 2942998 Photo


Registered User
74 posts

I am playing with a menu and CSS.

The question is IF the element has the same class assigned shouldn't it follow the styling?

In the attached picture, all the elements have class nav-link-1, the dropdowns have an additional class of dropdown-toggle but shouldn't they also follow the nav-link-1?
Attachments:
User 2699991 Photo


Registered User
4,799 posts
Online Now

I thinkThose drop downs will have the sting applied to the additional class
Mastering The Understanding With Hands-On Learning
NEW TO "COFFEECUP SITE DESIGNER" FOUNDATION 6 FRAMEWORK?
STUCK ON SOMETHING?

LEARNING & UNDERSTANDING "THE HOW TO"? THE WHY'S & THE WHEREFORE'S?
WITH WAYAN'S STEP BY STEP TUTORIALS
Contact Me For One To One Assistance
https://alphathemes.coffeecup.com/forms … an%281%29/
User 2942998 Photo


Registered User
74 posts

Yeah, I suspected that, I removed the dropdown-toggle class and it still didn't follow the nav-link-1 class. That would also bring up another question of why assign additional classes if they aren't followed?
User 122279 Photo


Senior Advisor
14,450 posts
Online Now

Keith, what I usually do in such cases:
If I give the elements class names myself, I give them one which is common for them all, like in your case 'nav-link-1'. Then I style them the way I want them. When that is done, I add the 2nd class names to those that need a 2nd one, and do the styling which is specific to them.

Or, if the class names alle all there already, I click in the middle of the 2nd class name to 'disable' it while I style everything pertaining to the first class name. Afterwards I click once more on the 'disabled' ones to make them come alive again, and continue styling the specific ones.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 2942998 Photo


Registered User
74 posts

Thanks for the info, that's pretty much what I have been doing.

The menu is a component and it actually acts the same way, you have to style the dropdowns and the non-dropdown. In the grander scheme of things, it's not a big deal. Still, things like this just make CSS difficult to understand.

Thanks again.
User 122279 Photo


Senior Advisor
14,450 posts
Online Now

If you tell us which component, and in which framework you are working, we might be able to help you better.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 379556 Photo


Registered User
1,535 posts

Keith Van Wemmer wrote:
The question is IF the element has the same class assigned shouldn't it follow the styling?

It is not clear what elements (<button>, <select> etc.) are being used in the example quoted, but it is, of course, not necessarily the case that an element with the same class follows the styling.

A. If one's CSS has the following, then a paragraph and an h1 element, each having class="bgc", would have a background of yellow -

.bgc {background-color:yellow;}

B. If, on the other hand, one's CSS has the following, a paragraph with that class would have a yellow background, but an h1 element with that class would have a blue background -

p.bgc {background-color:yellow; }
h1.bgc {background-color:blue; }

SD4 sets classes for particular element tags as at B above, as can be seen from the CSS it generates. The answer to the question quoted above seems therefore to be 'No' if the elements don't have the same tag (e.g. <p>, <h1>).

Frank

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.