answersLogoWhite

0

either <center> or <div align="center"> then your content and then </center> or </div> eg: <center>Hello</center> or <div align="center">Hello</div>

User Avatar

Wiki User

16y ago

Still curious? Ask our experts.

Chat with our AI personalities

EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
ViviVivi
Your ride-or-die bestie who's seen you through every high and low.
Chat with Vivi
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
More answers

For unordered list:

<ul style="text-align:center">

<li>Item</li>

</ul>

Ordered list:

<ol style="text-align:center">

<li>Item</li>

</ol>

User Avatar

Wiki User

15y ago
User Avatar

When you add a table inside of another table in HTML, the second table is said to be "nested."

Nesting tables is straightforward. You simply define the HTML for the inner table within a table cell of the outer table. For instance

This is a cell

Nested table cell 1NT Cell 2

The important part of this is to keep track of what HTML elements are open as it's easy to become confused. You might want to create the inner table in a separate file and then copy and past the entire thing at once, into the cell you're aiming for.

User Avatar

Wiki User

12y ago
User Avatar

You use the CSS "margin" property to center a table in an HTML or XHTML document.

To do this, you're going to set the left and right margin to "auto."

So...

<table class="test-table">

...

</table>

Given this sample table, you want to add the following rule to your style sheet. For the example, I'm going to use an internal stylesheet.

<style type="text/css">

table.test-table { margin-right:auto; margin-left:auto; }

</style>

You can also use the margin short-hand property, giving us, instead

table.test-table { margin: 0 auto; }

In that case, the first value is for the top and bottom, and the second for right and left. In the more elaborate short-hand (top, right, bottom, left) it would be the same as margin: 0 auto 0 auto;

Obviously, you can also put this directly into a style attribute on the table tag if you're in a pinch.

<table style="margin: 0 auto;">

But you want to avoid this if there's going to be more than one occurrence of a centered table on the site.

User Avatar

Wiki User

13y ago
User Avatar

AnswerAdd
margin: 0px auto; to the style attribute of the table.

e.g.
User Avatar

Wiki User

15y ago
User Avatar

Here is an example:

<img src="./image/myImage.png" alt="My Image" style="width:100px;height:100px;float:left;margin:0 auto;" />

That will centre your image.

User Avatar

Wiki User

15y ago
User Avatar

I'd use div tags:

<div style="position:absolute;top:100px;">

put whatever you want in here

</div>

User Avatar

Wiki User

16y ago
User Avatar

<center><h1>Your header<h1></center>

User Avatar

Wiki User

12y ago
User Avatar

Add your answer:

Earn +20 pts
Q: How do you center text with HTML code?
Write your answer...
Submit
Still have questions?
magnify glass
imp