ID for HTML Header?

How can I give an id to a control so that i can add css style to it in the html header? For instance if I have a rectangle, how can I give it an id so that I can set up css style in the html header? Or is there a property already to use that allows me to reference the control?

this way use a class name

<style>
.city {
  background-color: tomato;
  color: white;
  border: 2px solid black;
  margin: 20px;
  padding: 20px;
}
</style>
</head>
<body>

<div class="city">

this should give the id= a style

#firstname {
background-color: yellow;
}

this way give the h2 tag a style ( Pseudocode)

<style>
h2 {
  background-color: tomato;
  color: white;
}
</style>

and whereby ths style is usually a extra .css file.

<head>
<link rel="stylesheet" href="mystyle.css">
</head>

This is what I am using at the moment…

Public Sub Add_CSSclass(Extends wc As WebControl, CssClassName As String)
  Var s As String = "document.getElementById('" + wc.ControlID + "').classList.add('" + CssClassName + "');"
  wc.ExecuteJavaScript( s )
End Sub


2 Likes

Will give this a try. Thanks for the help.