我正在使用require()从jquery函数调用HTML文件。但是我无法将CSS与HTML文件链接。运行文件后,仅显示纯HTML。
我的HTML文件:
public class DemoException {
@Test(expectedExceptions = {ConnectException.class})
public void testException() throws ConnectException
{
//pseudo code......
//create a List<WebElement> myList
int count = 0;
for(WebElemet we: myList){
we.connect(); //this may or may not throw exception
we.getResponseMessage(); // further actions on we is needed
we.disconnect();
//above 3 are HttpURLConnection methods to be precise
// Basically do - connect, getResponse, disconnect
System.out.println(count++);
// print count is needed - exception thrown or not thrown
}
}
}
我的jquery函数:
<head>
<script src="jquery-3.4.0.js"></script>
</head>
<div class="wdg-uniplick">
<table class="data-table">
<tr>
<th class="col-id" id="id-h">Plick Order</th>
<th class="col-name" id="name-h">name</th>
<th class="col-date" id="date-h">Date</th>
<th class="col-nr-tx" id="nr-tx-h">Nr. Tx</th>
<th class="col-amount" id="amount-h">Amount</th>
<th class="col-state" id="state-h">State</th>
<th class="col-actions"></th>
</tr>
<tr id="row-0">
<td class="col-id" id="id-d0"></td>
<td class="col-name" id="name-d0"></td>
<td class="col-date" id="date-d0"></td>
<td class="col-nr-tx" id="nr-tx-d0"></td>
<td class="col-amount">
<div class="sub-2" id="ccy-d0"></div>
<div class="sub-1" id="amount-d0"></div>
</td>
<td class="col-state" id="state-d0">-</td>
<td class="col-actions">
<img id="action-icons-d0" src="../img/search-20.svg">
</td>
</tr>
</table>
</div>
我有一个content.css文件。
答案 0 :(得分:1)
要链接外部css
文件,您需要使用以下内容:
<head>
<link rel="stylesheet" href="styles.css">
</head>
答案 1 :(得分:0)
我认为您尚未在HTML文件中添加content.css
文件。如果添加它,您也可以加载CSS
<link rel="stylesheet" type="text/css" href="content.css">
否则您可以在jquery中完成
$("<link/>", {
rel: "stylesheet",
type: "text/css",
href: "content.css"
}).appendTo("head");