Which one do you prefer: display: table/table-cell vs floats for two column layout?
-
Flex box aside, which one do you prefer for creating a two-column fixed-and-fluid layout: display: table/table-cell or float-based techniques? Using table/table-cell makes it easy to make both columns have the same height, but yet looks like they are not as popular as other techniques.
-
Answer:
I would advise against using floats for layout. Now I know that they have been used in this manner for a long time, and it has become standard practice, but it's just not what floats were meant for. Evidence of this is the need for a clearfix hack. I often use display: inline-block; for layout, but if you are after two equal height columns, then display: table-cell; is the way to go. is advising against this, but I must respectfully disagree. While you wouldn't use a table for layout (instead using it for tabular data), there is nothing wrong with using the CSS display property to change an elements behaviour. After all, that's what the property is there for. The table-cell value has great browser support (http://caniuse.com/#search=table), and can be incredibly convenient in many situations.
Joshua Hibbert at Quora Visit the source
Other answers
I have always and for the foreseeable future will continue to use floats. I have never had troubles with them and they have worked perfectly so far. I really do detest the idea of getting rid of <table> based layouts and then bringing them back through CSS. With display:table I essentially get the same result, except with less compatability, as I do with floats.
Thomas Foster
Related Q & A:
- If you were to start using a Wordpress framework today, which one would you use?Best solution by WordPress
- How to display HTML table with angularJS?Best solution by Stack Overflow
- Which one do u like better hollywood or bollywood?Best solution by Yahoo! Answers
- Which phone do you prefer: Samsung Propel or LG Vu?Best solution by Yahoo! Answers
- Which EMAILS do u prefer excluding YAHOOMAIL GMAIL HOTMAIL AOLMAIL LIVEMAIL YAHOOMAIL GMAIL?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.