I'm a student who is making some money for my uni in a few moths. I never had direct experience with html or css. It has been mostly a hobby.
I am trying to make a deadline, which has a red background. I don't know why, but I have white borders at the text line at the sides. But more annoying is, the border on the top, there should not be a border or white space at all.
It's probably something easy, would you please have a look? Edit: Forgot to tell you I can only use css ot=r html, no Javascript.
My html file:
<!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>
My 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 {
}
Try setting this at the top of your CSS file:
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;
}
This resets all the browser differences and I got it from here http://meyerweb.com/eric/tools/css/reset/
I don't see an issue with white borders around your text but to fix your white space issue add this to your css
body{margin: 0;}
#headline > h1 {margin-top: 0px;}
See fiddle: http://jsfiddle.net/1g1pdqbc/1/
This works ( see fiddle ):
body {
margin-left: 0;
margin-right: 0;
margin-top: 0;
}
#headline h1 {
margin-top: 0;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.