Support » Fixing WordPress » DOT in menu item css class

  • I tried adding a dot inside css class in Menu options but after clicking Save, it disappears. Is it possible to add a dot in CSS class? Like: container.container1

Viewing 2 replies - 1 through 2 (of 2 total)
  • if container is a valid id or element and container1 is a valid class.

    you could use .classname or #id.classname or p#id.classname .

    • This reply was modified 1 year, 8 months ago by mrtom414.

    You cannot add a dot as part of a class name when you are defining individual menu items because it is used in stylesheets to indicate a class name. What you should do is add a class name for a menu item, then when you write the rule, you add the dot to the front end to indicate that it is a class name.

    For example, let’s say there’s a particular menu item that you want to have bold red text. You would add a class name like stand-out to the menu item, and then, when you write the CSS rule in your custom CSS, it would look like this:

    
    .menu-item .stand-out {
       color: #f00;
       font-weight: 700;
    }
    

    The dot inside the rule says “this is a class name, not an ID,” so the browser will look for an element that has stand-out as a class name, there’s no need to add the dot when you define the element.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘DOT in menu item css class’ is closed to new replies.