Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
myListItem.Attributes.Add("style", "background-color: BLUE");
<style type="text/css">
.listClass{background: #000080;}
</style>
<asp:ListBox id="myList" cssClass="listClass" .....
Ah, sorry my fault! I forgot that the list items will not render the style attribute. There is an article on this and workaround here:had a bit of trouble getting it to accept the add.attribute
<SELECT id="ListBox1" runat="server" Size="10">
</SELECT>
Protected WithEvents ListBox1 As System.Web.UI.HtmlControls.HtmlSelect
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim li As ListItem
For i As Integer = 1 To 10
li = New ListItem
li.Text = i
li.Value = i
li.Attributes.Add("style", "background-color: BLUE")
ListBox1.Items.Add(li)
li = Nothing
Next
End Sub
Yes, I think there are a few ways of doing it.is it possible to define checkbox style for a given element, not the whole page
#myDiv option
{
background-color: Blue
}
option.myClass
{
background-color: Blue
}