linkbutton风格

时间:2012-02-26 15:13:02

标签: css linkbutton

我正在使用C#.net制作工作簿创建者(使用visual studio)

本书是从文本部分和问题部分构建的。

问题的所有答案都在文本的旁边,用户需要单击正确的答案。 如果他是对的话那么这个词会变成绿色,如果他错了,它会变成红色。

我正在使用linkbutton,我需要它没有和“链接”样式。

我将此代码用于问题部分:

public class question
{

public void createQusetion(Panel leftside, string text, string question,string answer)
{
    string[] Qbuttonstext = text.Split(' ');
    for (int i = 0; i < Qbuttonstext.Length; i++)
    {
        LinkButton answerButton = new LinkButton();
        if (Qbuttonstext[i] == answer)
        {
            answerButton.ID = "answer";
        }
        else
        {
            answerButton.ID = "word" + i.ToString();
        }
        answerButton.Text = Qbuttonstext[i].ToString()+" ";
        answerButton.CssClass = "textbuttonB4";

   answerButton.Click += new EventHandler(checkAnswer);

     leftside.Controls.Add(answerButton);
    }


}
}

我使用了css样式表并使用了这段代码:

.textbuttonB4 a:link
{
   style:none;
   color:Black;
   font-size:18px;
   border-bottom-style:none;
   background-color:transparent;
   text-decoration: none;
}
.textbuttonB4 a:hover
{
  style:none;
   color:Black;
   font-size:18px;
   border-bottom-style:none;
   background-color:transparent;
   text-decoration: none;
}
.textbuttonB4 a:visited
{
    style:none;
   color:Black;
   font-size:18px;
    border-bottom-style:none;
    background-color:transparent;
    text-decoration: none;

}

当运行文本的代码仍然显示为链接时。

在寻找网络寻求解决方案之后,不要知道它为什么不起作用。

抱歉此问题的上一版本。

阿萨夫

1 个答案:

答案 0 :(得分:1)

检查输出源。按钮是否有适当的类?你还记得包含样式表吗?

此外,style:none;做了什么?它不是有效的CSS。