How can I set the tables side by side? - html

How can I set the tables side by side? I'm a bloody rookie, I know there are more elegant ways to do my code, I'd appreciate your input, i posted my code on pastebin since I had a werid error here
My HTML code: https://pastebin.com/gq73n05Q enter code here
This is how my Website looks like & below how I want it to be: https://imgur.com/a/Fa5No00

So, in my view, best way to get two tables side by side is to put them into divs.
You'd add a div before your first table (line 32 in your pastebin) that looks like such:
<div class="column">
<!---your left hand table goes in here --->
</div>
Then you do exactly the same for your second table (new div at line 59, same class as above).
<div class="column">
<!---your right hand table goes in here --->
</div>
Then you add some style rules to govern your two new divs. I'd hugely recommend doing this in a section at the top of your page somewhere.
<style>
.column {
display:inline-block;
width:50%;
float:left;
}
</style>
If you wanted to inline those styles, then each div would start like this:
<div style="display:inline-block;width:50%;float:left;">
That will make the columns appear side by side as you want.
You should note, you are going to run into other troubles though. You've hard-coded in a lot of "width" rules in the tables and table cells which will impact the responsiveness of your page and, in general, unless you're doing an html email, you'd really want to steer clear of tables for layout purposes.
If you'd like to see a best-practice implementation of it anyway, there's this one on w3schools.com: https://www.w3schools.com/howto/howto_css_table_side_by_side.asp it has quite an elegant look which might prove useful.
Good luck with it!

Related

Lining up left Floating Div's to look like a table

I'm trying to line up these div's, but it seems to not be working correctly.
the web address is - http://www.minvera.com/hosting-price-sheet
I need all the div's to line up because it's supposed to be similar to a table, but I hate tables.
Any suggestions?
A table is a table and if you want to make a table yous should actually make a table :-) Tables are not bad per se. Ommiting a table just because you dont like tables is wrong. On the other side you are using <br> which should be avoided.
Whatever: If you open up your code between your rows you have some <p> and inside those you have <br> between some links without text.
Remove those <br> and your table looks correct. Those <p> are actually over the full width of your container and therefore are pushing down subsequently the following divs. Maybe they are from some html editor? If you need the links in separated lines make them display:block
It's hard for me to see why you need it that way, because I would have placed my divs differently.
Your div are seperated by a paragraph and in contain a wich make the line break. Also there always a line break after the paragraph so you have to play with the padding and the margin to remove it.
Hope this help.
You can also use display:inline-block; on each div to make them side by side (work without float).

Image Table in HTML

I want to do exactly like this for my self-hosted wordpress site - http://www.dota2.com/heroes/
I assume they put separate pictures in a table (could be completely wrong)
Any suggestions on where should I start ?
Actually if you check the source code you can see that they are using DIV to place the element like they want. You can do it with a table too if you want (it could be easier!).
If you want to do it "exactly like them" you can make a container with a fixed width, and they insine you could add your images with a fixed width.
I would also advise you to check "Source Code" ! It will be very helpful (I think)!
(If you are using chrome as main navigator : https://support.google.com/adsense/answer/181951?hl=en)
Hope it helped you
I would avoid table. From my experience, tables are hard to work with.
I would rather go with <ul><li></li></ul> or <div class="container"><div class="pic"></div></div>
The <li></li> or <div class="pic"> will have float:left so that they get rendered one after another.
If you feel that the data you are rendering are actually a table, then only table makes sense.
Your data is not a table with multiple columns.

Align two div's to left

Basically what i want to do is this:
http://jsfiddle.net/wQBq5/20/
without using tables.
Here is an attempt:
http://jsfiddle.net/vaDCQ/
This fiddle shows the basics: http://jsfiddle.net/cA3su/. But there are differences. For one thing, the "inner" divs don't stretch all the way to the right like the table does. For another, you need to understand how floats and clears work. It takes some practice and experimentation. In short, divs will never work exactly the way tables do. But once you know how to do it, divs get you free of a lot of the headaches that tables create.
You can achieve this using float.
You can use something like this (basic example):
html:
<div class="left-container">1</div>
<div class="right-container">
<div class="number2">2</div>
<div class="number3">3</div>
</div>
css:
.left-container{float:left;width:100px;}
.right-container{float:left;width:100px;}
.right-container .number2{float:left;width:100%;}
.right-container .number3{float:left;width:100%;}
Here is my example.. http://jsfiddle.net/wQBq5/37/

How to utilize DIV tags to work like Table Columns

please refer to the picture to get a better visual idea.
I do not have access to Table element because the free edition of the framework I am using "ZK framework" does not have tables but it has DIV .
so think of a Table with some rows and three columns: I used a DIV tag with Left Margin and drew the elements of my left column..
<div id="leftColumn" width= "45%" align="left" style = "margin-top:10px;margin-bottom:10px;margin-right:30px;margin-left:20px;">
I am thinking of using the second column of this table for the spacing between elements on each row and using the third column to put my right hand side elements on it...
so now for the other two DIVs how should I set its properties to look correct?
and actually do you have any better design thoughts?
Thank you.
.divsYouNeedToColumn { display: inline }
in your css should solve your problems.
By the way, the framework restricting tables seems very... stupid.

CSS: how to position buttons in groups across a row on a web page

I would prefer a CSS approach to using tables for this.
I have six buttons on a horizontal row. The buttons are grouped like this:
button1 button2 button3 button4 button5 button6
The left two buttons are on the left margin and are close to each other but are not touching.
The third button is in the middle -- doesn't have to be exactly centered, just separate.
The three buttons on the right are grouped together on the right margin, also not touching each other.
When the page is resized, the two buttons on the left stay on the left, while the three on the right slide back and forth with the right edge of the page.
This has to work in IE7.
Edit: If like me, you are struggling with the "layout tables vs. CSS" issue, check out this SO question. Over 600 upvotes.
IME, you should use a one- or two-row table. This kind of thing, which is a very common need, is also a huge pita with CSS. You could spend days. And, for once, it's not an IE shortcoming. So, in this case, I would just bow to the inevitable and use a small table. As I say, IMHO.
-- pete
Updated answer:
The best I could do without tables is this.
Details:
Works in IE7-8-9, FF 4, Chrome 10
Therefore should work fine in earlier FF/Chrome, and by extension Safari
Opera is unknown, but it should work there as well
Pure CSS, HTML uses div and ul/li for the button lists
Drawbacks:
Includes CSS hack to target IE7 -- it's only a tiny one (*display: inline), but there you have it.
You have to add the right side buttons in the reverse order you want them to display -- this is due to float: right and I don't know of a way to fix it while keeping the flush right alignment
This was still bugging me three years later. The best CSS solution I have come up with is this. It's still using tables, but with CSS. And it's easier to do some of the styling -- we can set the table-cell text alignment at the table level instead of the cell level.
This performs well when the screen is resized.
I'm using style attributes here for clarity.
<div style="display:table; width:100%; text-align:center;">
<div style="display:table-row;">
<div style="display:table-cell; width:7%;">button1</div>
<div style="display:table-cell; width:7%;">button2</div>
<div style="display:table-cell; width:65%;">button3</div>
<div style="display:table-cell; width:7%;">button4</div>
<div style="display:table-cell; width:7%;">button5</div>
<div style="display:table-cell; width:7%;">button6</div>
</div>
</div>