Webmaster Articles and Tools

Search Articles: Total 1 User(s) Online
 
Total 12484 Quality Articles Written by 1694 Expert Author(s).

Login | Home | FAQ | About Us | Contact Us | Site Map | Exchange Links
Webmasters!
Top Quality PLR Articles
Home | Webmaster | Web Development | How To Fix CSS Float ...

How To Fix CSS Float Issues

Submitted by Sameep on 2007-10-11 and viewed 142 times.   
Rate This Article | Add Comments | Send To Friends|
View Comments (0) Publisher | Print Download as PDF

There are 2 CSS Float issues that tend to crop up during website design and testing - the object floating outside of parent container and float Peekaboo Bug / IE Float Doubled Margin Bug. Here's how to fix them.

CSS is great. On somedays I'd go so far as to say it's a lifesaver. But every now and then you'll encounter a CSS issue that will drive you crazy. In this case we'll talk about two of the more common issues when using the float property to create your layout. For those of you who're new to CSS, Float is a CSS property that allows you to align your elements, such as DIVs, to create website layouts. The values for Float include Left, Right and None. You can use Floats to align elements and if done properly you can do in such a way that it's dynamic -- almost fluid. Let's say you need to create an image gallery. Your idea is to place 4 images on each line, but after you place the first image the second image goes to the next line. I'll admit in the past I used to use negative values to align my images so that the second image would show up next to the first one using the margin-left, right, top, bottom property. I even considered using tables, but opted to use negative values instead. There's nothing wrong with using negative margin property, but not when there's a better solution for it, such as using floats. If you apply Float to those images then they'll align in one row, then you can continue to add more images using the float property and you wouldn't have to worry about whether they'd line up or not because the float property will recognize that there's too many elements on this line and it will push the images to the next line. But what if you're using Floats for your website layout, for your divs and not just the images. There are 2 main issues that you'll face with Floats. Let's say you have three elements. Parent1(website's main container), Child1(left navigation bar), an
d Child2(content area). Parent1 is the main div container and your goal is to float the child divs side by side sort of like having a left navigation area and a right content area. Sounds great. You've set your parent1's height to auto, and you've set child1 and child2's height as auto. But once you open and view it in a webpage the parent element's height is only 1 or 2pixels in height, the child elements seem to look like they're floating above the parent container, and the parent container doesn't seem to recognize the div's height. (see test link 1 on website). No worries, here is an easy solution for it. Add overflow:auto; for the CSS of the parent container and it will automatically recognize the floats and will increase in height so that it appears that the floats are part of the parent container just as you wanted. Wow all that in one line. But don't forget there's still one more Float issue. The second issue is more of a cross browser compatibility issue with floats, but still as important. If you try to Float for ex: three images to the left and are using margin property, then sometimes the first container that floats will have double the margin in Internet Explorer. Welcome to the Float Peekaboo Bug / IE Float Doubled Margin Bug. That's right if you've tried to Float an element and use any kind of margin then you'll notice that it will double the margin in IE. I'm sure there are some decent hacks, but there's an easy way to fix this in CSS. The Float Margin Killer. In the CSS for that container add display:inline I don't know why but for some reason this property seems to fix the double margin property. That's it? Yes that's it. Now you can start using floats.

Article Source: http://ateau.com/


Article Tags: houston website design| css| float|
Bookmark This Articles: del.icio.us * Digg it * Furl * reddit * Spurl * Yahoo MyWeb
Sam is the founder of Netlyte Houston website Design, A Website Design firm that's geared specifically for building websites for Businesses. Websites that have generated real results such as increase in newsletter sign ups to increase in sales. Plus all of their services are backed by a 100% Guarantee.




  • Web publishing
  • Web Development and Design in London: Using Divs versus using Tables.
  • Seven Social Network Script Reviews
  • What Does Your Customer Really Want?
  • Finding The Best PHP Dating Script Online
  • Tips To Make Your Website Load Faster
  • An Introduction To Content Management Systems
  • What CMS Tools Does Your Business Need?
  • Thinking About Using A Website Template?
  • Purpose of Social Network Community Software
  • Essential Components for Software for Social Networking
  • Do You Need Social Networking Software?
  • Features Of Extensible Markup Language Used In Professional Web Design
  • Using XML In Professional Web Design
  • Markup Language For Professional Web Design
  • Image Attributes Used In Professional Web Design
  • Navigation In Professional Web Design
  • Working With HTML Text In Professional Web Designing
  • Basics Of HTML For Professional Web Design
  • Use Of Microsoft FrontPage In Professional Web Design
  • Tips For Professional Web Design
  • Using Google Adwords To Drive Traffic To Your Website
  • How To Create A Business Website
  • How To Minimise Shopping Cart Abandonment
  • 4 Proven Success Factors For The Internet Home Business Opportunities
  • 7 Important Rules in Small Business Website Development
  • Belong To The Exchange Club For Website Links
  • 3 Killer Tips For Your Internet Home Business Website Brief
  • Mistakes To Avoid When Using Web Templates
  • Powerhouse Dreamweaver Training Tips
  • Spring Cleaning and Website Maintenance for Your Website
  • The Benefit of Using Dreamweaver CS3 Templates
  • How to Build a Database Driven Web Site
  • Programming Styles Used In Web Development
  • Why Should You Use VBScript?
  • Choosing A Content Management System For Your Website
  • How To Make Your First Web Form
  • Why Is XQuery Important?
  • Knowing HTML Is Not Nearly Enough
  • Your First Online Form
  • What Is Formmail And How Does It Work?
  • Creating Your First HTML Form
  • Time To Give Your Website A Stress Test
  • Learn to Create a Web Form
  • Your First HTML Email Form
  • Tips For Starting A Discussion Forum
  • Learn to Create an Online Form
  • Your First Web Form
  • XML is Transforming the Internet
  • Learn How To Use Formmail
  • What Is Javascript Used For?
  • Issues With Formmail
  • Article Directory Scripts that Pay Off Big Time
  • Information is the hottest product on the market!
  • Royalty Free Music - Licensing & Copyright
  • Making Residual Income Out of Stationary Capital
  • Deciphering Website Design - Front End Development
  • Web Design And Development Tips To Maximize Your Site
  • Content Management - An Overview Of Its Workflow
  • Web Content Management To Enhance Your Business Online
  • Shopping Cart Scripts Review
  • The Evolution of Macromedia DreamWeaver
  • How To Learn Dreamweaver
  • E-commerce Website Design Guide for Small Business Owners
  • Learn How to Build Complete Websites in Three Days
  • Macromedia Dreamweaver Vs Microsoft FrontPage
  • Do You Have An Authoritative Website?
  • Make Money Online By Making A Website
  • Using Automated Scripts to Improve Web Site Productivity
  • Search Engine Friendly CMS
  • Building an Effective Website
  • 7 Cheap Ways to Promote Your Website Offline
  • How to Easily Explode Your Website Traffic?
  • How To Start an Online Traffic Virus Today
  • Perpetual Traffic Generation Tips
  • How To Quickly And Easily Start A Traffic Virus
  • Traffic, Traffic and More Traffic
  • How a Benefit-Rich Headline Can Build Your Web Business
  • Who Invented Internet Commerce
  • Five Essential Web Writing Guidelines
  • Secret To Using Press Release To Generate Huge Traffic
  • The Secret to Using the Word Free In Your Online Promotions
  • The Secret to Effectively Generate Website Traffic
  • How To Send An HTML Newsletter
  • Low-Cost Website Traffic Building
  • Deciphering Website Hosting
  • How to Get Unlimited Traffic Forever!
  • Use CGI For Quality Websites
  • Find Out How to Easily Turn traffic into Customers
  • How to Easily Get Traffic to Your Website Forever
  • How To Drive Low Cost Traffic To Your Site
  • How To Effectively Build a Network
  • AS400 Web Development
  • Website Conflict: Design vs. Marketing (Part 2)
  • Website Conflict: Design vs. Marketing (Part 1)
  •  
     
    Number of Ratings: 0
    Rating: 0

     
    Email:
    Password:
     
    Name:
    Email:
    Password:
    Comments:
     
    Please Enter Human Verification code:
    What Other are ...
    How To Fix...





    (c)Copyrights All Rights Reserved | Privacy Policy | Terms of Use