?
Solved

Dead Center on the Page

Posted on 2012-12-31
1
Medium Priority
?
294 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 53

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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 tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

770 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