Solved

Dead Center on the Page

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

803 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