I'm extremely new to HTML/CSS so this may be a stupid question, but I'm having a hard time centering my text in my navigation bar. I don't know how to properly center it horizontally OR vertically, so to get it horizontally I've just put a 25% left margin on the left-most element in the nav. I'm assuming that's not the proper way to do things. As for how to vertically center the text, I have absolutely no idea how to go about doing that.
As an added question, could anybody tell me how to make text scale when resizing the browser window? When I make the width of the window smaller, all my text scrunches up on the screen.
P.S. I'm doing this as an assignment for a class I'm in, but my instructor didn't really help.
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Mini Vocaloid Wiki</title>
<meta charset="utf-8" />
<link href="styles.css" rel="stylesheet" />
</head>
<body>
<div id="page">
<nav id="topNav">
<a id="left" href="vocaloids.html">Vocaloids</a>
<a href="about.html">About</a>
<a href="contact.html">Contact</a>
</nav>
</div>
</body>
</html>
CSS:
body, html {
height: 100%;
width: 100%;
margin: 0;
}
#page {
height: 100%;
width: 100%;
background-color: yellow;
padding: 1%;
background-image: url('images/background_image.jpg');
background-repeat: no-repeat;
}
#topNav {
border: 2px solid black;
border-radius: 8px;
margin-left: auto;
margin-right: auto;
width: 66%;
height: 5%;
text-align: center;
background-size: cover;
background-position: bottom left;
background-repeat: no-repeat;
background-image: url('images/blurred_background.jpg');
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
font-size: 2em;
}
nav a {
display: inline-block;
text-decoration: none;
color: white;
float: left;
width: 15%;
height: 100%;
margin-right: 1%;
}
#left {
margin-left: 25%;
}
#topNav a:hover {
border-radius: 8px;
background-color: white;
color: black;
}
Edit: Here's a link to an image of what it currently looks like. I forgot to add this in. http://puu.sh/ld0LM/2de7d95deb.jpg
Edit 2: I was told by my instructor to use % instead of px whenever possible so that it scales when the browser window is changed, but is it reasonable to use % for almost everything? I assume that if i changed my nav height to something around 50 or 100px and then made my line-height the same, it would solve my problem, but I can't do that with %.