Solved

Floating and clearing tables

Posted on 2014-01-18
8
207 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Refresh div via ajax without lost ccs <li> styles 8 48
Problem to refer to value 8 63
Under active page on navigation bar 8 16
Head to not include on scroll 4 23
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

830 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