GVKun编程网logo

html – 如何更改选择框箭头[复制](html怎么设置选择框)

15

针对html–如何更改选择框箭头[复制]和html怎么设置选择框这两个问题,本篇文章进行了详细的解答,同时本文还将给你拓展c#–如何将数据绑定到HTML选择框、c#–如何更改选择中DataGridVi

针对html – 如何更改选择框箭头[复制]html怎么设置选择框这两个问题,本篇文章进行了详细的解答,同时本文还将给你拓展c# – 如何将数据绑定到HTML选择框、c# – 如何更改选择中DataGridView中的特定单元格、css – 如何更改选择下拉框的边框颜色?、css – 如何更改选择框选项背景颜色?等相关知识,希望可以帮助到你。

本文目录一览:

html – 如何更改选择框箭头[复制](html怎么设置选择框)

html – 如何更改选择框箭头[复制](html怎么设置选择框)

参见英文答案 > Select arrow style change8个
我需要你的帮助.

我似乎无法绕过这一个并想出来.如何更改选择框中的默认Windows 7,IE 10默认箭头:使用下面的自定义箭头使其看起来像这样:

这是我想要使用的箭头:

这是我的HTML标记:

<!DOCTYPE html>
<html>
<head>
   <style type="text/css">
   select { font: normal 13px Arial; color: #000;}
   .container {
         border: 1px solid red;
         position: relative; width: 124px; height: 18px; overflow: hidden;
    }
   .inpSelect {
        color: black; background: #ffa;
        position: absolute; width: 128px; top: -2px; left: -2px;
    }
   </style>

<script type="text/javascript">
</script>

</head>

<body>

<div>
    <selectname="xxx">
        <option value="0" selected="selected">actual browser</option>
        <option value="1">IE</option>
        <option value="2">Firefox</option>
        <option value="3">Opera</option>
        <option value="4">Safari</option>
    </select>
</div>
</body>

</html>

解决方法

您可以使用纯css箭头跳过容器或背景图像:
select {

  /* make arrow and background */

  background:
    linear-gradient(45deg,transparent 50%,blue 50%),linear-gradient(135deg,blue 50%,transparent 50%),linear-gradient(to right,skyblue,skyblue);
  background-position:
    calc(100% - 21px) calc(1em + 2px),calc(100% - 16px) calc(1em + 2px),100% 0;
  background-size:
    5px 5px,5px 5px,2.5em 2.5em;
  background-repeat: no-repeat;

  /* styling and reset */

  border: thin solid blue;
  font: 300 1em/100% "Helvetica Neue",Arial,sans-serif;
  line-height: 1.5em;
  padding: 0.5em 3.5em 0.5em 1em;

  /* reset */

  border-radius: 0;
  margin: 0;      
  -webkit-Box-sizing: border-Box;
  -moz-Box-sizing: border-Box;
  Box-sizing: border-Box;
  -webkit-appearance:none;
  -moz-appearance:none;
}

样品here

c# – 如何将数据绑定到HTML选择框

c# – 如何将数据绑定到HTML选择框

我的sql数据库中有一个名为“WEB_SEL_Security_QUESTIONS”的存储过程,它返回一个表,如下所示.

SEQURITY_QUESTIONS_KEY,KEYCODE,QUESTION

我需要填充一个html选择框,其中包含我从执行上述过程中获得的问题列表.

这就是我尝试过的

String s = ConfigurationManager.ConnectionStrings["ConnectionString2"].ToString();
sqlConnection con = new sqlConnection(s);
con.open();
sqlDataAdapter myAdepter = new sqlDataAdapter("WEB_SEL_Security_QUESTIONS",con);
myAdepter.SelectCommand.CommandType = CommandType.StoredProcedure;
DataSet ds = new DataSet();
myAdepter.Fill(ds,"WEB_SEL_Security_QUESTIONS");
String questions = ds.Tables["WEB_SEL_Security_QUESTIONS"].Rows[]["QUESTION"].ToString();
securityQuestion1.DataSource = questions;
securityQuestion1.DataBind();

但是这只用一条记录填充选择框,它生成列表项,每个列表项只有一个字符,只有第一个记录.

解决方法

你可以尝试:

securityQuestion1.DataSource = ds.Tables["WEB_SEL_Security_QUESTIONS"];
securityQuestion1.DataTextField = "QUESTION";
securityQuestion1.DataValueField = "KEYCODE"; // Or whatever the value field needs to be.
securityQuestion1.DataBind();

您的第一次尝试只是从一个问题中获取单个值并将其用作整个数据源.因此,您需要的目标是使整个安全问题表成为数据源,然后给出关于用于值和显示的列(DataTextField,DataValueField)的提示.

c# – 如何更改选择中DataGridView中的特定单元格

c# – 如何更改选择中DataGridView中的特定单元格

使用列表框,我有以下代码来提取所选项:

private void inventoryList_SelectedindexChanged(object sender,EventArgs e)
    {
        String s = inventoryList.SelectedItem.ToString();
        s = s.Substring(0,s.IndexOf(':'));
        bookDetailTable.Rows.Clear();
        ...
        more code
        ...
    }

我想为DataGridView做类似的事情,也就是说,当选择更改时,检索所选行中第一个单元格的内容.问题是,我不知道如何访问该数据元素.

任何帮助是极大的赞赏.

解决方法

我认为这就是你要找的东西.但如果没有,希望它会给你一个开始.

private void dataGridView1_SelectionChanged(object sender,EventArgs e)
{
    DataGridView dgv = (DataGridView)sender;

    //User selected WHOLE ROW (by clicking in the margin)
    if (dgv.SelectedRows.Count> 0)
       MessageBox.Show(dgv.SelectedRows[0].Cells[0].Value.ToString());

    //User selected a cell (show the first cell in the row)
    if (dgv.SelectedCells.Count > 0)
        MessageBox.Show(dgv.Rows[dgv.SelectedCells[0].RowIndex].Cells[0].Value.ToString());

    //User selected a cell,show that cell
    if (dgv.SelectedCells.Count > 0)
        MessageBox.Show(dgv.SelectedCells[0].Value.ToString());
}

css – 如何更改选择下拉框的边框颜色?

css – 如何更改选择下拉框的边框颜色?

enter image description here

有没有办法将下拉框的蓝色边框线更改为其他内容?

解决方法

@Joshua,Did you try this

.input:focus {
    outline: none !important;
    border:1px solid red;
    Box-shadow: 0 0 10px #719ECE;
}

Find it here

css – 如何更改选择框选项背景颜色?

css – 如何更改选择框选项背景颜色?

我有一个选择框,我试图更改的选项的背景颜色时,选择框被单击并显示所有的选项。

See Fiddle

html

<select>
    <option val="">Please choose</option>
    <option val="1">Option 1</option>
    <option val="2">Option 2</option>
    <option val="3">Option 3</option>
    <option val="4">Option 4</option>
</select>

css

select{
    margin:40px;
    background: rgba(0,0.3);
    color:#fff;
    text-shadow:0 1px 0 rgba(0,0.4);
}

解决方法

您需要在选项标记上放置background-color,而不是选择标记…
select option {
    margin: 40px;
    background: rgba(0,0.3);
    color: #fff;
    text-shadow: 0 1px 0 rgba(0,0.4);
}

如果你想为每个选项标签样式。使用css属性选择器:

select option {
    margin: 40px;
    background: rgba(0,0.4);
}

select option[value="1"] { /* value not val */
    background: rgba(100,100,0.3);
}

select option[value="2"] { /* value not val */
    background: rgba(200,200,0.3);
}

/* ... */

今天关于html – 如何更改选择框箭头[复制]html怎么设置选择框的分享就到这里,希望大家有所收获,若想了解更多关于c# – 如何将数据绑定到HTML选择框、c# – 如何更改选择中DataGridView中的特定单元格、css – 如何更改选择下拉框的边框颜色?、css – 如何更改选择框选项背景颜色?等相关知识,可以在本站进行查询。

本文标签: