[英]Having white border on text background
我是一名学生,在短短的几天内就为我的大学赚了一些钱。 我从来没有直接使用 html 或 css 的经验。 这主要是一种爱好。
我正在尝试制定一个红色背景的截止日期。 我不知道为什么,但两侧的文本行有白色边框。 但更烦人的是,顶部的边框,根本不应该有边框或空白。
这可能很简单,请您看一下好吗? 编辑:忘了告诉你我只能使用 css ot=r html,没有 Javascript。
我的 html 文件:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="Standart.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
</head>
<body>
<div id='headline'>
<h1> Test </h1>
</div>
</body>
</html>
我的CSS:
@charset "utf-8";
@import url(http://fonts.googleapis.com/css?family=Open+Sans:700,400);
#headline {
font-family: 'Open Sans', sans-serif;
font-weight: 700;
text-transform: uppercase;
font-size: 24px;
position: relative;
text-align: center;
color: #ffffff;
background-color: #e31f36;
}
#bild {
}
#bildweg {
}
#menueoben {
}
尝试在 CSS 文件的顶部设置它:
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
这会重置所有浏览器差异,我从这里得到它http://meyerweb.com/eric/tools/css/reset/
我没有看到文本周围有白色边框的问题,但要解决您的空白问题,请将其添加到您的 css 中
body{margin: 0;}
#headline > h1 {margin-top: 0px;}
见小提琴: http : //jsfiddle.net/1g1pdqbc/1/
这有效(见小提琴):
body {
margin-left: 0;
margin-right: 0;
margin-top: 0;
}
#headline h1 {
margin-top: 0;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.