Usage of cssfloat floating attributes and Examples

Source: Internet
Author: User
In website development, cssfloat is a frequently used css attribute. It is used to set the floating direction (left and right floating) of css block-level elements ). This article introduces the usage and instance application of cssfloat to coders. For more information about coders, see. Float floating attribute of Css, used to set tag objects (for example:

Tag box, Tag, tag,The floating layout of tags and other html tags. float: left, float: left, and float: right ).

What does float mean? Float is floating, and Translation into Chinese is floating. Go to the corresponding css manual to learn the basic information about float.

The function of float: defines float (float) through css to let the p style layer block, float left or right (.

I. float syntax
float : none | left |right

Parameter value:
None: the object is not floating.
Left: the object is floating on the left.
Right: The object is floating on the right.

Next we will explain how to use float through an example.

Ii. float application and usage

Float floating is used to set the floating style of objects to the left and right, so that the DIV, SPAN, and other labels can move left to the right.

Simple syntax

P {float: left}/* css Note: Set p object floating to left (left) */p {float: right}/* css Note: Set p object floating to right (right) */

Iii. Case study of css float

Create a horizontal menu

Use floating to create a hyperlink list for the horizontal menu.


   
  • Link one
  • Link two
  • Link three
  • Link four

Online operation

Iv. css floating Summary

We need to distinguish the text content from the text content to the left (text-align: left) to the right (text-align: right) style. Floating only sets the left-to-right floating style for html tags. Float floating style does not depend on the middle (floating Center) style. If you need to center the label object, we will center the text in the css layout to give you a detailed introduction (css margin ). Remember to use float: right for float to the right and float: left for float to the left.

Related reading:

CSS tutorial

CSS3 tutorial

CSS Reference Manual

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.