Solved

Dead Center on the Page

Posted on 2012-12-31
1
285 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 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 310 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now