Is it possible to set a background image specifically for a content placeholder? Currently, I can display a background image for the entire page, but the content placeholder covers most of the picture. I would like to set a background image for the content placeholder instead, as most of the important content resides within it.
Below is my code for displaying the background image, but I am unsure how to apply it to the content placeholder in ASP.NET:
protected void dropListActivity_SelectedIndexChanged(object sender, EventArgs e)
{
if (dropListActivity.SelectedItem.Text == "GrassHopper and Ants")
{
PageBody.Attributes.Add("style", "background:url(Images/background/ant-and-grasshopper.jpg) no-repeat;");
Session["Background"] = "background:url(Images/background/ant-and-grasshopper.jpg);";
}
if (dropListActivity.SelectedItem.Text == "Food Fit For A King")
{
PageBody.Attributes.Add("style", "background:url(Images/background/King.jpg) no-repeat;");
Session["Background"] = "background:url(Images/background/King.jpg);";
}
}
In my HTML code, I simply added a body with the id "PageBody" which worked successfully. However, I am unsure how to achieve the same result within a content placeholder. As a novice in programming, CSS, and HTML, any guidance would be greatly appreciated.