1

How to add CSS for dropdownlist in angularjs2 preview here

HTML below

<h1> <label>Cameras:</label> <h1> 
<select [(ngModel)]="selectedCountry.id" (change)="onSelect($event.target.value)"> 
  <option value="0">--Select--</option> 
  <option *ngFor="#country of countries" value= {{country.id}}>{{country.name}}</option> 
</select> 
<br/><br/> 
<div> 
  <label>URI:</label>
  <br/> 
  <select> 
    <option *ngIf='selectedCountry.id == 0' value="0">--Select--</option> 
    <option *ngFor="#state of states " value= {{state.id}}>{{state.name}}</option> 
  </select> 
</div> 
<br/> 
<button class="button">StartRecording</button> 
<button class="button">Stop Recording</button>

CSS below

.dropdown { float: left; overflow: hidden; } 
.dropdown .dropbtn { 
  font-size: 16px; 
  border: none; 
  outline: none; 
  color: white; 
  padding: 14px 16px; 
  background-color: inherit; 
} 
.navbar a:hover, .dropdown:hover .dropbtn { background-color: red; } 
.dropdown-content { 
  display: none; 
  position: absolute; 
  background-color: #f9f9f9; 
  min-width: 160px; 
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); 
  z-index: 1; 
}

OP should add more info here. He mention in comment that he want some styles for the dropdown

sTx
  • 1,168
  • 12
  • 30
venu
  • 29
  • 5
  • have you tried anything? What it's not working? Please share the relevant code for your problem here. – sTx Oct 17 '17 at 12:01
  • 1
    I've edited your code, wait until it's validated, then add your CSS as well in your post – sTx Oct 17 '17 at 12:08
  • see the code above @sTx – venu Oct 17 '17 at 12:09
  • share the CSS too; and try do describe your problem(what is not working, what do you want to achieve, etc) – sTx Oct 17 '17 at 12:11
  • see the above css code and i want some color or deisgn pattern in dropdownlist @sTx – venu Oct 17 '17 at 12:14
  • I've edited your code again but please read [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) – sTx Oct 17 '17 at 12:23
  • yes ok and could you tell me how to add design or color to dropdown list – venu Oct 17 '17 at 12:27
  • you can read [here](https://stackoverflow.com/a/24671889/5393271). Judging by your css(which is not used anywhere in your html) I think you wanted to do something like [this](https://www.w3schools.com/css/css_dropdowns.asp) – sTx Oct 17 '17 at 12:30
  • The class you have style here in css isn't applied anywhere in your html code above it. Also are you trying to get a drop down menu up there on the top where you have "Home", "Cameras", "Dropdown" or are you trying to style the 2 drop down lists Camera and URL? – Ms. Nobody Oct 17 '17 at 12:48

0 Answers0