How to make table height 100%? - html

I am having a problem, I have my website: yusifmusic.com organized so that the links (Biography, Tour History, etc) are in a drop-down list. HOWEVER, as you can see, once the text goes beyond the left column, it starts to stretch into the left column. One fix was to add a ton of breaks to the code (in between the p and end span tags, near the bottom). However, that adds a lot of blank space to the bottom of the page. I'm sure there must be a better solution. I tried making the table height = 100% with styles, no luck. Would just like this left column table to extend to infinity in height, so that the center text on this webpage will be indented when it is revealed. It's really sloppy looking the way it is right now... How can I do this?
<table bgcolor="#000000" width="200" border="0" align="left" cellpadding="35";>
<tr><td>
<div align="center">
<span style="font-size: 12pt">
<u>Tour Dates:</u><p></span>
<span style="font-size: 8pt">
<P>
2/26 - 50 Mason Social House - San Francisco, CA<br><br>
etc... <br><br>
<p>
</span>
</td></tr>
</table>
<P><br><br><br>
<p>
<div align="center" class="geo">
CONTACT: booking#yusifmusic.com etc etc
<br>
<br>
<script language="javascript">
function toggleBio() {
var ele = document.getElementById("toggleBio");
var text = document.getElementById("displayBio");
if(ele.style.display == "block") {
ele.style.display = "none";
text.innerHTML = "BIOGRAPHY";
}
else {
ele.style.display = "block";
text.innerHTML = "hide";
}
}
</script>
<font size = "4"><center>
<a id="displayBio" href="javascript:toggleBio();">BIOGRAPHY</a> </center></font>
<div id="toggleBio" style="display: none">
<center><b>Yusif!</b></center>
<center><i>Yusif!</i> (self-released)</center>
<center><u>Biography</u></center>
<p>
<p align="left">
"Sometimes our most destructive moments... etc etc<br><br>

I have found personally that dealing with tables to design website layouts is usually painful, and so in general a lot of webdevelopment is moving away from tables and to div tags, classes and stylesheets.
I know this isn't a small immediate fix to your problem, but I think you could easily move a lot of this to Bootstrap.js to fix this problem very quickly and easily.
http://twitter.github.com/bootstrap/scaffolding.html
In particular, you can use the scaffolding to create three "columns" or vertical sections, for which you could insert your existing code into.
The separators would for the bottom section, given that you are using bootstrap properly for the rest of the page would look something like this:
<div class="row">
<div class="span4">...Tour Dates Code...</div>
<div class="span4">...Middle Column Code Contact....Bio....</div>
<div class="span4">...Code for The Red Column...</div>
</div>
Another thing which is probably a quicker fix, is to include the whole of the bottom in one "parent table". You can play around with the cell widths and percentages yourself. Having the code be within a parent table will help the sections retain their form.
<table bgcolor="#000000" width="100%" border="0" >
<tr>
<td>....Insert left table that has bgcolor="#00000" and cellpadding="35" </td>
</tr>
<tr>
<td>...Insert Center Code here....</td>
</tr>
<tr>
<td>...Insert right table that has cellpadding="8" and bgcolor="#550000"...</td>
</tr>
</table>
You can read more about tables here: http://www.w3schools.com/html/html_tables.asp and other places online.
I'd also recommend removing the align tags from within the tables, and managing the width and positioning them from the parent cell container.

Related

IE 10 will not open my web page image on top left of screen

For some reason IE10 will not open the image in the tope left of my webpage. Chrome and Firefox have no issues. Here's the code for the table that includes the images. The image 'han' shows up as a single vertical line of pixels 196px high. :
<table style="width:100%" align = "center">
<tr>
<td>
<img src= "images/han.jpg" height = "196" width "304">
<p class = "co">Find your target first.</p>
</td>
<td>
<img src = "images/logo.gif" height = "294" width ="582" >
<br>
<p class ="co">So what's the bag limit on womp rats anyway?</p>
<td>
<img src = "images/greedo.jpg" height = "196" width = "304">
<p class = "co">Bad table fare.</p>
</td></tr></table>
It's got to be something really obvious that I am missing here. Every page has the same error.
This might or might not be the reason (as UnknownFury said, a jsfiddle reproducing the issue would help), but it looks like you're missing a = between width and its value.
You have: <img src= "images/han.jpg" height = "196" width "304">
It should be: <img src= "images/han.jpg" height = "196" width="304">
If the former works in any browser, it's by chance and due to browsers trying their best to correct invalid HTML for you.
Like I said...."got to be something really obvious"...I was simply missing the "=" sign. Even the debugger said "Hey dude you're missing ="...I think your eyes get trained to see it after doing it so much even though it's not there. Thanks for the help people.

How to wrap a table in a link?

What elements allow link?
I want to wrap a link around a table,
<a href="123.php" class="grap" >
<table border="1" style="width:600px; height:600px;">
<tbody>
<tr>
<td align="center" style="border:1px solid red"><img src="thumb-pic-1.jpg" alt="123"/></td>
</tr>
</tbody>
</table>
</a>
But it is not a correct html as in http://validator.w3.org/
I can put the link in a form like this,
<form action="123.php" class="grap" >
<table border="1" style="width:600px; height:600px;">
<tbody>
<tr>
<td align="center" style="border:1px solid red"><img src="thumb-pic-1.jpg" alt="123"/></td>
</tr>
</tbody>
</table>
</form>
But the link or the table is not meant to be a form form submission...
I wonder if there are anyway to wrap a table in a link?
EDIT:
Sorry forgot the mention that I need to grab the link url like this,
$('.grap').click(function(){
alert($(this).attr('action'));
return false;
});
<a> is an Inline-Element and <table> is a block element. Block elements are not allowed in inline elements in xhtml. But what about a click listener on the table, or an div around the table? The effect should be the same.
This might be also interesting for you:
Is it wrong to change a block element to inline with CSS if it contains another block element?
Browsers let you wrap a table inside a link. The practical problems with it relate to rendering (browsers may or may not underline the text content and draw borders around images inside a link), not with basic functionality. It’s not valid as per HTML 4.01 for example, but so what?
In your example, the table contains just one cell that contains just one image. You could instead use just an img element and style it suitably. In a more complicated case, a table might be useful. Then you should probably set color and text-decoration for it in CSS and border for any img contained in it, so that you get the rendering you prefer and not the varying browser default rendering for a situation like this.
You can not wrap a block level element (such as a table) in an inline element (such as an anchor). You could, however, use display: block; to make the anchor block level.
You could also use Javascript event handlers to link the table. For instance, you could have this snippet of code in your head tag that assigns an onclick event to the table.
Where, idOfYourSpecifiedTable is the id attribute of your table (ie <table id='idOfYourSpecifiedTable'>),
<script type="text/javascript">
document.getElementById('idOfYourSpecifiedTable').onclick = function() {window.location.href='123.php'};
</script>
or in jQuery
<script type="text/javascript">
$(function() {
$('#idOfYourSpecifiedTable').click(function() {window.location.href='123.php';});
});
</script>
Furthermore, you could even use #idOfYourSpecifiedTable {cursor: pointer;} to make the cursor a pointer (hand) when a client hovers over it.
However, this method has its weaknesses. Notably, a search engine robot will likely not detect your table as linked to another page of your site.

Tricky CSS layout of external (facebook like and google plusone) buttons

What is the best way to place/layout the google+1 and facebook Like buttons so they align neatly?
Currently, the first "thing" in my body is this heading, appearing on top of all pages (slightly modified after logging in): (linebreaks added for readability) :
<table align="center" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left">
<g:plusone size="small" href="https://www.apebroker.com/">
</g:plusone>
<iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.apebroker.com%2Findex.php&send=false&layout=button_count&width=100&show_faces=false&action=like&colorscheme=light&font=arial&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
</td>
<td align="left"></td><td align="right">It's more fun after you
login
</td>
</tr>
</table>
My problem is that this looks like crap. I know that pages don't need to look exactly the same in every browser, but acceptable ugliness has its limits.
The google button is nicely "vertically centered", while the facebook stuff kind of sticks to the top of the page, 0px down.
See this example:
I tried adding padding:2px; to the style in the facebook iframe, and sure, it came down a bit, but so did the google button too, and the entire heading grew, pushing down the <hr> below.
I obviously don't know much about iframes, but I've managed fine on my own until now.
In my global style sheet I have (amongst other things) this:
body {
margin:0px;
padding:0px;
background-color:#e0e0b0;
color:#302010;
font-family:"Trebuchet MS",Helvetica,Sans-serif;
font-size:100%;
}
And I don't want to change that, as it cascades to all sorts of things that I'm reluctant to break. If you want to check out the complete style sheet and HTML source, an example page can be found here.
Thank you in advance for any hints/suggestions!
How about plus one button, and it's width?
<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
{lang: 'ru'}
</script>
A problem is that the table cells are sizing themself based on the font size even though there isn't any text in the table.
The "correct" answer is not to use tables for layout.
However, if you explicitly set:
<td align="left" style="font-size: 1px">
then your life will get slightly better as you'll be able to explicitly control the height of each of the cells and position things. At the moment despite you "asking" for a height of 21px, you're getting 26px.
After that the FB button will look nice and you'll need to move the +1 button around.
But, the real answer is not to use tables:
http://www.w3.org/2002/03/csslayout-howto
http://www.hotdesign.com/seybold/
and various others...
I've found a fix for this using to encapsulate both fb:like and g:plus separately, and then setting the style of both to style="vertical-align: top;". See example at http://www.clonearmycustoms.com/

side by side banner code

i have a side by side banner code ,the work fine on Firefox.IE,opera,. but not work on google chrome how do i solved this problem ?
<table border="0" width="100%">
<tr>
<td>my Banner</td>
<td> </td>
</tr>
</table>
Take them out of the table, and use CSS to float:left;each banner, inside a container div. As long as their width allows it, they should line up side by side, in Chrome as well.
using your example:
<div id='container'>
<img src='banner1.png' style='float:left;' />
<img src='banner2.png' style='float:left;' /></div>
The best way would be to use a .css stylesheet and a banner class to separate your html from your css, but this is just an example to get you started :)
EDIT: I don't use inline javascript really, ever..so this is just a guess if you can do this or not, but it's worth a try.
<div id='container'><span style='float:left;'>
<script language='JavaScript' type='text/javascript'
src='zarclick.ir/banner.php? uname=pitgo&type=2&rows=1' >
</script></span><span style='float:left;'><script language='JavaScript'
type='text/javascript' src='zarclick.ir/banner.php? uname=pitgo&type=2&rows=1'
></script></span></div>
Might work, I'd try it if I needed to do it.
You should read this tutorial on how to create tableless layouts as this is the standard used for web 2.0 pages. You should always seperate the content from the layout in your web page, which means that your HTML file/s should only display the content, while the CSS file/s will contain the layout, and the JS file/s will contain the HTML manipulation scripts.
http://webdesign.about.com/od/css/a/aa102102a.htm

HTML hyperlinked images moving etc

This is the site I'm working on and the CSS is in the same directory called saucy.css (sorry I can only post one hyperlink).
First of all, apologies for my awfully invalid HTML and CSS. I promise I'm going to fix it all once the site is up and running! However if this is causing the problems of course I will do it now.
My current problems:
When I add a hyperlink to the Twitter
icon it moves to the top left as it
is now. As you can see from the HTML
it should be under the main box (in
line with the copyright logo etc.) to
the left.
I have this strange text appearing
at the bottom of my page: ​. I am told it is to do with not being able to display a character properly, but I can't see what character it could be.
When I try and edit the CSS to
remove the link formatting on the
navbar, nothing happens.
I am unable to add a border to the
box in the centre of the page. As the
drop downs are part of the table, I
only want a border for the or
which is grey. Is it possible to
do this?
Thank you so much for reading!
Wow, it looks like you rushed to put this together... You really should take your time with it so you don't make mistakes. I see that you've inverted a TD tag where there should be a TR tag. I also see that you've closed a TR tag and decided to just use a TD tag instead, which i'm not sure if that's intentional or not lol. I'm going to comment on some of your code and ask you if it was intentional or not, but I will clean it up a bit first.
You should never just run all your code together, that's very bad practice and will cause you to forget to close tags. Always indent when you can. Whether you can write colspan=4 or not is irrelevant, you should always put it in quotes like this: colspan="4" and for all other properties.
For the level you're at, you should be using xhtml. This will force the browsers to use the standardizations and prevent your site from looking "weird" on one browser but perfect on another.
Here is your code that I commented on. You really need to go through it and match ALL of your opening/closing tags correctly. You've made a nice mess for yourself lol. Have fun.
<table align="center" width="60%" cellspacing="0" cellpadding="5">
<tr>
<td colspan=4>
<div class="logo">saucydares</div>
<div class="slogan">fun and games for couples everywhere!</div>
</td>
</tr>
<tr class="links">
<td class="links" colspan=4 width="100%" align=center>HOME | ABOUT | ARCHIVE | DARE BOX</td>
</tr>
<tr>
<td colspan=4 class="main" cellpadding=10>
<br><br> <!-- Breaks should always be <br /> XHTML only //-->
<table height="270px" width="450px" align=center cellpadding="5">
<tr class="box">
<td align=center>
<div id="dare">Welcome to Saucy Dares! To get going, adjust the settings below and click "Dare me!".</div>
</td>
</tr>
<!-- There is no TR tag here.
Was it on purpose? //-->
<td height="20px" align=right cellpadding="0">
<form name="form">
<select id="mode" name="mode">
<option value="classic">Classic Collection</option>
<option value="long">The Long Game</option>
</select>
<select name="player">
<option value="him">For him</option>
<option value="her">For her</option>
<option value="double">Double dare</option>
</select>
<input type="button" value="Dare me!" onClick="get();">
</form>
</tr> <!-- You closed the parent TR before the child TD //-->
</td> <!-- This TD no longer applies to anything because you
closed its parent row //-->
</table>
<br><br> <!-- Breaks should always be <br /> XHTML only //-->
<b>Latest news</b>
<UL>
<LI> Welcome to the new look Saucy Dares! Now you can take things to the next level with the new game mode, The Long Game. You can also both get involved by selecting 'Double dare' from the second drop down box. Read more about the new game modes on the About page.
<LI>Dares now appear without needing to refresh the page meaning your settings aren't reset every time you view a new dare.
<LI> What do you like about the new design? What is still missing? Let us know on Twitter! You can also follow #SaucyDares to receive updates whenever new features and dares are added.
<LI> You can now share your favourite dares with us by putting them in the Dare Box!
</UL>
</tr> <!-- Because you already closed the TR in your
child table, this is going to cause some
weird effects lol //-->
</td> <!-- More weird effects are going to occur until
you match the correct closing tags to
their opening tags //-->
<tr class="footer"><img src="facebook_border.gif">
<img src="twitter_border.gif" alt="Twitter" border="0">
</td><td width="33%" align=center>© 2010 Saucy Dares</td><td width="33%" align=right>Click here to report an error</td></tr>
</table>
Here is the same code you used for your site but, I removed all the table elements to help you out and got it looking somewhat nice please check it out and let me know what you think or if you need anything else. I might have made some minor mistakes or not up to website standards but, this was done on the fly.
<h3 class="logo" style="text-align:center; weight:bold;">saucydares</h3> <!--center these in your css file. or inline style it like I did. -->
<h3 class="slogan" style="text-align:center;">fun and games for couples everywhere!</h3><!--center these in your css file. or inline style it like I did. -->
<div class="links" style="text-align:center;">
<br />HOME | ABOUT | ARCHIVE | DARE BOX<br /> <br />
</div>
<h5 id="dare" style="text-align:center;">Welcome to Saucy Dares! To get going, adjust the settings below and click "Dare me!".</h5><br />
<form name="form" style="text-align:center;">
<select id="mode" name="mode">
<option value="classic">Classic Collection</option>
<option value="long">The Long Game</option>
</select><br />
<select name="player">
<option value="him">For him</option>
<option value="her">For her</option>
<option value="double">Double dare</option>
</select>
<br />
<input type="button" value="Dare me!" onClick="get();">
</form>
<br /><br /> <!-- Breaks should always be <br />-->
<b>Latest news</b>
<UL>
<LI> Welcome to the new look Saucy Dares! Now you can take things to the next level with the new game mode, The Long Game. You can also both get involved by selecting 'Double dare' from the second drop down box. Read more about the new game modes on the About page.
<LI>Dares now appear without needing to refresh the page meaning your settings aren't reset every time you view a new dare.
<LI> What do you like about the new design? What is still missing? Let us know on Twitter! You can also follow #SaucyDares to receive updates whenever new features and dares are added.
<LI> You can now share your favourite dares with us by putting them in the Dare Box!
</UL>
<div style="text-align:center;" class="footer"><img src="facebook_border.gif"><br />
<a style="text-align:center;" href="http://www.twitter.com/saucydares" target="_blank"><img style="text-align:center;" src="twitter_border.gif" alt="Twitter" border="0" /></a>
<h3 width="33%" style="text-align:center;">© 2010 Saucy Dares</h3><p width="33%" style="text-align:center;">Click <a style="text-align:center;" href="mailto:saucydares#yahoo.com">here</a> to report an error</p>
</div>