Web Design Stuff
HTML Tutorials    CSS Tutorials    Web Hosting   Resources
Create a Web Page 101
Making Web Pages Intro What is a Web Page? Why Make a Web Page? The History of HTML Learn HTML or XHTML?
Basic HTML
Basic HTML Tutorials Basic HTML Necessities How to Make a Web Page How to Edit a Web Page The Basics of HTML Tags Basic HTML Page Structure HTML Attributes
HTML Font Codes
HTML Font Codes Intro HTML Font Color Codes HTML Font Size Codes HTML Font Style Codes HTML Bold/Italic Codes Combining Font Codes
Formatting Text
Formatting Text Intro Making Paragraphs Miscellaneous Formatting Headings & Subheadings Creating Hyperlinks
Using Graphics
Using Graphics on the Web Add Graphics to Your Pages Graphics and Accessibility How to Align Graphics Page Color & Background Graphics as Hyperlinks Horizontal Rules
Creating Tables
HTML Tables Tutorials HTML Table Fundamentals Background & Border Color Table Frames & Rules Table Width and Alignment Cells 1 -Space & Alignment Cells 2 -Row Column Span Cells 3 -Width & Height
Making Lists
HTML Lists Tutorials Bulleted Lists Numbered Lists Definition Lists
HTML Frames
HTML Frames Tutorials Using Frames for Layout Advanced Frame Layouts Putting Hyperlinks in Frames Frame Border Width Color, Margin and Control Problems with Frames SmartFrames: A Solution SSI: An Alternative to Frames
Web Page Forms
Making Feedback Forms A Simple Feedback Form Installing NMS FormMail Debugging Your Setup My Web Host is Out to Lunch User Input Components Text Fields Checkboxes & Radio Buttons Dropdown Menus Push Buttons Layout and Presentation
Basic CSS
Basic CSS Tutorials What is CSS? Why You Should Use CSS How to Use CSS Inline Styles Embedded Style Sheets External Style Sheets Class Selectors ID Selectors Combining Selectors
CSS Properties
CSS Properties Intro Font Styles Width, Height & Spacing Borders Backgrounds Position Float & Alignment Hyperlinks
All About Web Hosting
Hosting Your Own Website What is a Web Host? Your Website's Home Page Building a Website Offline About Free Web Hosting Best Free Web Hosting Commercial Web Hosting How to Get a Domain Name Ecommerce Web Hosting Web Hosting Terminology
Free Web Design Tools
Best Free Website Tools Best Free Text Editors Best Free Graphics Editors Free Website Analysis Tools
Setting Up HTML Kit
HTML Kit Introduction How to install HTML Kit Screenshot Breakdown Basic Configuration Overall Appearance Shortcuts and Startup Editing Window Customizing Toolbars Using the Favorites Tab Making a New Actions Bar Odds and Ends
Free Templates
Free Website Templates Two Column Fixed Width Three Column Liquid Layout Miscellaneous Templates Dynamic Menu Effects Two Column Experimental Terms of Use About These Templates
Website Templates Help
Getting Started Template Zip File Download How to Edit Your Template What to Edit in the HTML How to Add Your Logo Making a Website
Web Design Tips
Web Design Basics Tables vs. Tableless Using Tables for Layout Example Table Layouts World's Crappiest Web Page
Twitter Backgrounds
Twitter Backgrounds Intro Cool Twitter Backgrounds Cool Twitter Backgrounds 2 Plain Twitter Backgrounds Dark Twitter Backgrounds Best Twitter Backgrounds Cute Twitter Backgrounds Music Twitter Backgrounds Music Twitter Backgrounds 2 Twitter Backgrounds 101 TERMS OF USE
All About Web Browsers
What is a Web Browser? Mozilla Firefox Internet Explorer Opera How to Set Up Firefox Top 5 Firefox Extensions
 
Contact
Post Some Feedback Send Me An Email Iron Spider Blog About Iron Spider... Site Conventions
 
 
 

 

CSS Properties - Float & Alignment

 
The CSS properties in the table below can be used to define how various components on your web page are floated and aligned. These properties are typically applied to block elements but you can also apply them to images (text-align excluded) and some form elements. These include the following:

body, p, div, blockquote, table, td, ul, ol, li, form, input, textarea, select,


CSS Properties List 6 - Float & Alignment
Property NameSome Possible ValuesWhat It Does
floatleft | rightAligns block element
text-alignleft | center | right | justifyAligns text


NOTES:
  • Float ~ The float property can be used to align an entire block element to the left or right such that other content flows around it. It works exactly the same way as the HTML align attribute applies to the img element. Hence, if a block element is floated to the left, content will flow along its right side. Conversely, if the block element is floated to the right, content will flow along its left side. Naturally, the width of the floated element will have to be set smaller than that of its container in order to see the float in effect.

    Here are some examples:

    Example 1 - LEFT FLOAT
    <~This block element is floated to the left. Its width is set to 35%.
    The red box is a block element which contains this text and another smaller block element which is floated to the left (green box). This text flows along the right side of the green box and will continue as such until reaching the bottom of the green box at which point the text will run the entire width of the red box.

    Example 1 - LEFT FLOAT

    <div>
    <div style="float: left; width: 35%;">
    This div is floated left.
    </div>

    This text flows along the right side of the floated div...
    </div>


     


    Example 1 - RIGHT FLOAT
    This block element is floated to the right. Its width is set to 35%. ~>
    The red box is a block element which contains this text and another smaller block element which is floated to the right (green box). This text flows along the left side of the green box and will continue as such until reaching the bottom of the green box at which point the text will run the entire width of the red box.
    Example 1 - RIGHT FLOAT

    <div>
    <div style="float: right; width: 35%;">
    This div is floated right.
    </div>

    This text flows along the left side of the floated div...
    </div>


     
  • Text-align ~ You can use the text-align property to define whether the content of a block element is aligned to the left, right, in the center or justified to both margins. The content typically refers to text but can also apply to images and other block elements (the latter applies to Internet Explorer only). This essentially replaces the align attribute in HTML as it applies to positioning the content of a block element. The value can be one of the following:

    • left - The text is aligned to the left.
    • center - The text is aligned in the center.
    • right - The text is aligned to the right.
    • justify - The text is aligned to both the left and right.
    Example: text-align: justify;

    [NOTE: If you're still unclear what 'justified' means then the text on this web page can serve as an example. Notice how it is aligned (squared off) on both the left and right sides.]

*   *   *


So, are you tired of having underlining on your hyperlinks? The next page will show you (among other things) how to remove the underlining on your hyperlink text...





Best Free Stuff
for webmasters

Free Text Editors
Free Graphics Editors
Website Analysis Tools
Free Website Templates

See also:

Best Free Web Hosting
How to Make a Web Page

 

If you need a .COM web address, you can get one quick and easy at...

www.GoDaddy.com
<~ BACK TOP NEXT ~>
 
HTML Tutorials |  CSS Tutorials |  Web Hosting |  Domain Names |  Web Design Resources
Iron Spider © Copyright 2004-2011 Robert Darrell