CSS下拉菜单样式重叠

时间:2017-08-09 14:59:41

标签: html css wordpress drop-down-menu

问:是否有人知道如何设置我网站上的子菜单样式,以便它不像现在一样重叠?

我已经在CSS中执行此操作,但所有子菜单都会移动,而不仅仅是子菜单。

  

cherwelluk.com

翻转Windows并尝试选择木材替代品。

.nav.navbar-nav li ul.sub-menu li a {
    color: #FFF;
    text-transform: uppercase;
    padding: 5px 0px;
    display: block;
    font-size: 14px;
}

Image

2 个答案:

答案 0 :(得分:0)

尝试添加以下CSS。

//our root app component
import {Component, NgModule, VERSION} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
import { ReactiveFormsModule, FormGroup, FormBuilder } from '@angular/forms';

@Component({
  selector: 'my-app',
  template: `
  <form [formGroup]="form">
    <div formArrayName="unitArr">
    <label><input type="checkbox" />Select all</label>
    <label><input type="checkbox" />unSelect all</label>
      <div 
        *ngFor="let unit of units; let i = index"
        class="unit"
        (click)="onClick(i)"
        [ngClass]="{'unit-selected': unitArr.controls[i].value}">
          <input type="checkbox" formControlName="{{i}}"/>
          <div class="unit-number">{{ unit.num }}</div>
          <div class="unit-desc">{{ unit.desc }}</div>
      </div>
    </div>
  </form>
  `,
  styles: [`.unit-selected { color: red; }`]
})
export class App implements OnInit{
  private units = [
    {num: 1, desc: 'Decription'},
    {num: 2, desc: 'Decription'},
    {num: 3, desc: 'Decription'},
  ];
  private form: Form;
  
  constructor (private fb: FormBuilder) {}
  
  ngOnInit () {
    this.form = this.fb.group({
      unitArr: this.fb.array(
        this.units.map((unit) => {
          return this.fb.control(false); // Set all initial values to false
        })
      )
    });
  }
  
  // Shorten for the template
  get unitArr (): FormArray {
    return this.form.get('unitArr') as FormArray;
  }

  onClick(i) {
    const control = this.unitArr.controls[i];
    control.setValue(!control.value); // Toggle checked
  }
}

@NgModule({
  imports: [ BrowserModule, ReactiveFormsModule ],
  declarations: [ App ],
  bootstrap: [ App ]
})
export class AppModule {}

答案 1 :(得分:0)

您可以添加此CSS规则以将子子菜单移动到子菜单的右侧:

.nav.navbar-nav ul li ul.sub-menu {
    left: 200px;
}