Solved

HTML 5 and Css

Posted on 2013-02-02
3
164 Views
Last Modified: 2013-02-02
Hello folks,

   I have a page in which I am converting to use HTML 5. As such, I am creating a css for it. The existing web page uses the <div align="center"> and I am stumped as to what the equalivent would be in CSS. It will have an image and I want it to be centered on the page displayed to the viewer.
Your help is appericiated. :)
0
Comment
Question by:Overthere
3 Comments
 
LVL 11

Accepted Solution

by:
MajorBigDeal earned 500 total points
ID: 38847032
www.w3.org/Style/Examples/007/center.en.html

P.blocktext {
    margin-left: auto;
    margin-right: auto;
    width: 6em
}
0
 
LVL 6

Expert Comment

by:nickinthooz
ID: 38847064
#div {
text-align:center;
padding: 10px;
}

Open in new window


you can do it with other tags but make sure they are the same size as your div in order to find a true center.

For Example:
#mydiv {
width:300px;
height:300px;
text-align: center;
border:dashed;
}
#p {
width: 280px;
padding: 0 10px 0 10px;
}

Open in new window

<div id="mydiv"><p>this is your centered text</p></div>

Open in new window

Here is a jfiddle example of it.
0
 

Author Closing Comment

by:Overthere
ID: 38847442
Thank all of you for responding. The link provided by MajorBigDeal was excellent and very helpful.
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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

911 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

22 Experts available now in Live!

Get 1:1 Help Now