Safari中的HTML下拉菜单字体更改

时间:2015-12-20 13:08:23

标签: html css

我试图制作简单的html下拉菜单,保持在屏幕顶部,但到目前为止,我的尝试以这样结束:



    body {
	margin: 0px;
	padding: 0px;
	background-color: yellow;		
}
				
ul#header{
	position: fixed;
	display: inline-block;
	top: 0%;
	width: 100%;
			
	margin: 0px;
	padding: 0px;
			
	min-width: 500px;
						
	background-color: gray;
	list-style-type: none;
}
		
ul#header > li{
	float: left;
}
		
ul#header > li > a{
	display: block;
	color: white;
			
	padding: 5px 10px;
	text-decoration: none;
}
				
ul#header > li > ul{
	position: absolute;
			
	margin: 0px;
	padding: 0px;
	
	list-style-type: none;
	background-color: blue;
}
		
ul#header > li > ul > li{
	float: none;
}

ul#header > li > ul > li > a{
	display: none;
	text-decoration: none;
	color: white;
	
	padding: 5px 10px;
}

ul#header > li:hover > a{
	background-color: black;
}

ul#header > li > ul > li > a:hover{
	background-color: black;
}

ul#header > li:hover > ul > li > a{
	display: block;
}

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>Test</title>	
	<link rel="stylesheet" type="text/css" href="style.css">	
</head>
<body>
	
		<ul id="header">
			<li><a href="#">Home</a></li>
			<li><a href="#">Item 1</a></li>
			<li><a href="#">Drop 1</a>
				<ul>
					<li><a href="#">Dropped Item 1</a></li>
					<li><a href="#">Dropped Item 2</a></li>
					<li><a href="#">Dropped Item 3</a></li>
				</ul>
			</li>
			<li><a href="#">Item 2</a></li>
			<li><a href="#">Item 3</a></li>
			<li><a href="#">Drop 2</a>
				<ul>
					<li><a href="#">Dropped Item 1</a></li>
					<li><a href="#">Dropped Item 2</a></li>
					<li><a href="#">Dropped Item 3</a></li>
				</ul>
			</li>
			<li><a href="#">Item 3</a></li>
		</ul>
	
	
	<p style="margin: 50px 25px;">ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVW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TUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ </p>
	
</body>
</html>
&#13;
&#13;
&#13;

看起来它正在工作,但是当你将鼠标悬停在下拉菜单上时,你会注意到字体会稍微改变一下并在下拉菜单关闭时跳回来。

1 个答案:

答案 0 :(得分:1)

尝试使用-webkit-font-smoothing: subpixel-antialiased;。这是一个特定于webkit的属性,对于非webkit浏览器它不存在。您可以在http://maxvoltar.com/sandbox/fontsmoothing/了解有关此媒体资源的更多信息。

&#13;
&#13;
    body {
	margin: 0px;
	padding: 0px;
	background-color: yellow;		
}
				
ul#header{
        -webkit-font-smoothing: subpixel-antialiased;
	position: fixed;
	display: inline-block;
	top: 0%;
	width: 100%;
			
	margin: 0px;
	padding: 0px;
			
	min-width: 500px;
						
	background-color: gray;
	list-style-type: none;
}
		
ul#header > li{
	float: left;
}
		
ul#header > li > a{
	display: block;
	color: white;
			
	padding: 5px 10px;
	text-decoration: none;
}
				
ul#header > li > ul{
	position: absolute;
			
	margin: 0px;
	padding: 0px;
	
	list-style-type: none;
	background-color: blue;
}
		
ul#header > li > ul > li{
	float: none;
}

ul#header > li > ul > li > a{
	display: none;
	text-decoration: none;
	color: white;
	
	padding: 5px 10px;
}

ul#header > li:hover > a{
	background-color: black;
}

ul#header > li > ul > li > a:hover{
	background-color: black;
}

ul#header > li:hover > ul > li > a{
	display: block;
}
&#13;
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>Test</title>	
	<link rel="stylesheet" type="text/css" href="style.css">	
</head>
<body>
	
		<ul id="header">
			<li><a href="#">Home</a></li>
			<li><a href="#">Item 1</a></li>
			<li><a href="#">Drop 1</a>
				<ul>
					<li><a href="#">Dropped Item 1</a></li>
					<li><a href="#">Dropped Item 2</a></li>
					<li><a href="#">Dropped Item 3</a></li>
				</ul>
			</li>
			<li><a href="#">Item 2</a></li>
			<li><a href="#">Item 3</a></li>
			<li><a href="#">Drop 2</a>
				<ul>
					<li><a href="#">Dropped Item 1</a></li>
					<li><a href="#">Dropped Item 2</a></li>
					<li><a href="#">Dropped Item 3</a></li>
				</ul>
			</li>
			<li><a href="#">Item 3</a></li>
		</ul>
	
	
	<p style="margin: 50px 25px;">ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGH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