HTML attributes and corresponding CSS Methods

Source: Internet
Author: User

Reprinted: http://www.w3cn.org/article/translate/2005/109.html

HTML attributes and corresponding CSS Methods

HTML attributes CSS Method Description
Align = "left"
Align = "right"
Float: left;
Float: right;

Float with CSSAny element: Pictures, paragraphs, Div, title, table, list, etc.

When you use the float attribute, you must define a width for the floating element.

Marginwidth = "0" leftmargin = "0" marginheight = "0" topmargin = "0" Margin: 0;

With CSS, margin can be set inAnyIn addition to the Body element, you can specify the top, right, bottom, and left margin values of the element.

Vlink = "#333399" alink = "#000000" link = "# 3333ff"

A: link # 3ff;
A: visited: #339;
A: hover: #999;
A: active: # 00f;

In HTML, the link color is defined as a property value of the body. The link style of the entire page is the same. With the CSS selector, the link styles of different parts of the page can be different.

Bgcolor = "# ffffff" Background-color: # FFF;

In CSS, any element can define the background color, not only the body and table elements.

Bordercolor = "# ffffff" Border-color: # FFF;

You can set a boeder for any element. You can define top, right, bottom, and left respectively.

Border = "3"
Cellspacing = "3"
Border-width: 3px;

With CSS, you can define the border of a table as a uniform style, or you can define the color, size, and style of the top, right, bottom, and left border respectively.

You can use the table, TD or th selectors.

If you need to set the border-less effect, you can use the CSS definition: border-collapse: collapse;

<Br clear = "Left">
<Br clear = "right">
<Br clear = "all">

Clear: left;
Clear: right;
Clear: both;

Many 2-or 3-column la s are located using the float attribute. If you define the background color or background image in the floating layer, you can use the clear attribute.

Cellpadding = "3"
Vspace = "3"
Hspace = "3"
Padding: 3px;

With CSS, you can set the padding attribute for any element. Similarly, you can set top, right, bottom and left for padding respectively. Padding is transparent.

Align = "center"

Text-align: center;

Margin-Right: auto; margin-left: auto;

Text-align only applies to text.

Block-level complaints such as Div and P can be horizontally centered through margin-Right: auto; and margin-left: auto;

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.