将css应用于第一个表

时间:2015-07-14 08:38:01

标签: html css

请参阅此示例:https://jsfiddle.net/kevalbhatt18/w361a9hg/

当你看到小提琴第一个结果窗口时。否则你想要看到我想要的东西。

  

我的问题是我把桌子和css全部工作正常但是   现在我想将 border-left:1px点缀; 仅应用于第一个表。

<div class='openDiv hide'>
    <table id="addPropertyValue1"></table>
    <table id="addPropertyValue2"></table>
    <table id="addPropertyValue3"></table>
    <table id="addPropertyValue4"></table>
    <table id="addPropertyValue5"></table>
</div>

我尝试过第一个孩子但没有工作

.openDiv :first-child{
        border-left: 1px dotted;
    }

  

注意:不要直接在id上应用css,如

.openDiv #addPropertyValue1{
    border-left: 1px dotted;
}

想要纯css解决方案会帮助我我不希望jquery或javascript在表上应用动态类

3 个答案:

答案 0 :(得分:5)

first-child内的表格使用.openDiv

像这样:

.openDiv table:first-child {
    border-left:1px dotted;
}

Updated fiddle is here.

答案 1 :(得分:1)

将css应用于第一个孩子

.openDiv table:first-child{
    border-left: 1px dotted #000;
}

答案 2 :(得分:0)

driver.get("http://domain.com/");
driver.findElement(By.id("UserName")).clear();
driver.findElement(By.id("UserName")).sendKeys("dinero");
driver.findElement(By.id("Password")).clear();
driver.findElement(By.id("Password")).sendKeys("password");
driver.findElement(By.cssSelector("input[type=\"submit\"]")).click();

//new Select(driver.findElement(By.id("dpApplication"))).selectByVisibleText("CheapCallingCards");
driver.get("http://ccadmin.dinerotesting.com/CRMProcessing/New-Customer-Orders-NS2");
driver.findElement(By.xpath("//*[@id='daily-sales-graph']/table/tbody/td[2]/td[8]/input")).click();

为了继续继续其余的表格

.openDiv table:nth-child(1){
    border-left: 1px dotted #000;
}

等..