Solved

Floating and clearing tables

Posted on 2014-01-18
8
205 Views
Last Modified: 2014-01-18
Hello

I need to clarify the use of clear.

I have two tables on a page.  I want them both to float left.

The first table on the page I have given this id:  TableFloatLeft  
and its css is

Table#TableFloatLeft;
float:left;
}

I have another table on the page that I want to have directly below it.

I haven't given it an ID yet or any css.  Waiting for your response here.

From what I have googled, at some place I need to insert a clear.  But I am not sure where I add the clear.

I have a feeling I add it to the css of the second table.

In my next comment I will give you a link to the page, work in progress.

Thanks!
0
Comment
Question by:Rowby Goren
  • 3
  • 3
  • 2
8 Comments
 
LVL 9

Author Comment

by:Rowby Goren
ID: 39790976
Here's the link to the page.  You'll see a bunch of <p>&nbsp;</p>'s in the source. They are only there temporarily to give you an idea of what I want the page to look like with the <p>&nbsp;</p>'s

Thanks

Link to test site
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39791012
There is no CSS in your page to float the table left and I can't see a reason why you'd need it. Forget about the floats on the tables and they'll just drop under one another by default - no need to mess with it.

You do have an align="left" attribute on both your tables which not supported in HTML5, so remove that and all will be well :)
0
 
LVL 58

Expert Comment

by:Gary
ID: 39791016
With bootstrap you can add a class of clearfix to the second table.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 58

Expert Comment

by:Gary
ID: 39791038
Wrap your first table in
<div class="row">
...
</div>
0
 
LVL 9

Author Comment

by:Rowby Goren
ID: 39791078
Hi

Removing align left worked fine.  The tables are now stacked as needed.  

However I am wondering what any additional advantage would be using Cathal's suggestions. Since this is using twitter bootstrap.

I will be splitting points so perhaps we can have a brief discussion on the advantages of adding  the class "row" /  clearfix to the second

I will be using the page as a template for others to use on this site, so I would like to optimize the layout as well as I can.

However, as I said, just removing the align left seems to fix it

AND the image table rearrange themselves reasonably well  on a cell phone. I assume that is thanks to twitter bootstrap?

Link to test page

Rowby
0
 
LVL 58

Expert Comment

by:Gary
ID: 39791083
The .row is just using Bootstrap to declare the div takes up all the width.
Don't split points - Chris was spot on, I missed the link initially.
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39791097
The formatting you have has nothing to do with bootstrap - just left to it's own devices it will work as you expect. The images realigning themselves is default behaviour - if there's not enough room on the line they'll drop to the next (now that you've removed the table!)

There is no advantage in adding a .row wrapper DIV - a table is a block level element by default, so wrapping one block in another serves no purpose in your case
0
 
LVL 9

Author Closing Comment

by:Rowby Goren
ID: 39791151
Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question