TMan
TMan

Reputation: 4122

Centering Unordered List without styles

I have a ul in a table via html. I can center the ul by calling:

style="display:inline-table"

Is there a way to center the unordered list without using styles/css?

Full Code:

  <ul width="50%" align="left" style="display:inline-table" font-weight="normal">
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li><font color="red">Note this list is left alligned but centered on the page</font></li>              
  </ul>

Upvotes: 1

Views: 608

Answers (1)

Dancrumb
Dancrumb

Reputation: 27539

There's no way to do this; centering is a form of styling. HTML simply defines the structure of a document and relies on styling for the rendering.

All browsers have a default stylesheet; if you don't provide one, the browser uses that stylesheet to determine how content should be rendered. Even if you do provide a stylesheet, the cascading nature of stylesheets mean that you're probably relying on at least one default CSS attribute on your page.

So, in short, you have to use styling.

Upvotes: 1

Related Questions