I have an a tag and a li inside it. The a tag colors the list items innterText. How can I nullify its effects on the color of its content and also remove the underline?
Code:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<ul>
<a href="google.com"><li>asd</li></a>
</ul>
</body>
</html>
答案 0 :(得分:1)
以<a>
标记<ul>
内置<ul>
<li>
<a href="#">
<ul>
<li>asd</li>
</ul>
</a>
</li>
</ul>
无效,并且它也无法通过W3C validation。但是,如果我理解你的问题,你可以试试这个:
ul li a {
text-decoration: none;
color: #b61c1c; /* For Example */
}
要删除下划线,您可以执行以下操作:
Your label IBOutlet is nil because you are creating a new viewcontroller instance and your viewcontroller is not attached any story board. you can pass self to func runTest() and on self you can call print. Hope it will help!
You can use this
import UIKit
class ViewController: UIViewController {
@IBOutlet var label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
test().runTest(self)
}
func print() {
label.text = "test123"
}
}
import UIKit
class test: UIView {
func runTest(controller:ViewController) {
controller.print()
}
}
答案 1 :(得分:0)
你可以这样设计:
<a style="text-decoration: none; color: #TheColorYouWant"></a>
答案 2 :(得分:0)
试试这个:
a {
background-color: transparent;
}
a:hover {
text-decoration: none;
}
答案 3 :(得分:0)
使用CSS。这将删除a和li元素的下划线:
a, li {
text-decoration: none !important;
}
答案 4 :(得分:0)
只需根据您在“a:-webkit-any-link”类中的要求添加样式。例如,如果要删除下划线,则只需添加“a:-webkit-any-link {text-decoration:none;}”。 注意:我们在Chrome浏览器中使用'-webkit-'。