[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Dead Center on the Page

Posted on 2012-12-31
1
Medium Priority
?
297 Views
Last Modified: 2012-12-31
I am trying to center a small amount of text (1-5 words) in the dead center of the page. I am not just talking about horizontal centering (<center></center>) but also vertical centering. I would like the text to always be in the very center of the window. Is there an easy way of doing this?
0
Comment
Question by:stakor
1 Comment
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 1240 total points
ID: 38733891
This seems to work

http://jsbin.com/oquzuj/1/

<!DOCTYPE html>
<html>
<head>
<style>
.center {
  position: fixed;
  top: 50%;
  left: 50%;
  margin-top: -50px;
  margin-left: -100px;
  background: #000;
  color:fff;
  padding:10px;
}
</style>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <div class="center">I am the center</div>
</body>
</html>

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question