How to remove Html table Cell spaces in Html5? - html

I have html script as below
<header>
<div id="header">
<table class="headertable">
<tr>
<td>
<table class="headertable">
<tr>
<td colspan="2">
<div id="site-title" class="site-title">
<img src="~/Images/site-title.gif" alt="site-title", title="site-title" id="img-site-title" style="display:block" />
</div>
</td>
</tr>
<tr>
<td>
<div id="fullbannerad" class="fullbannerad">
<img src="~/Images/fullbanner.gif" alt="fullbannerad", title="fullbannerad" id="img-fullbannerad" />
</div>
</td>
<td>
<div id="halfbannerad" class="halfbannerad">
<img src="~/Images/halfbanner.gif" alt="halfbannerad", title="halfbannerad" id="img-halfbannerad" />
</div>
</td>
</tr>
</table>
</td>
<td>
<div class="site-logo">
<img src="~/Images/site-logo.gif" alt="site-logo", title="site-logo" id="img-site-logo" />
</div>
</td>
</tr>
</table>
</div>
</header>
below is the css
table.headertable {
border-spacing: 0;
border-collapse:collapse;}
.headertable td {
padding:0;}
There is a space added between td & table(nested table) elements to the page in the code below (this I checked in chrome debugger)
<td>
<table class="headertable">
How can I resolve this issue? Please suggest.

Extra whitepsace in your document should be ignored by the browser. If you having problems with your page layout, it won't be due to extra spaces in that position.

I resolved this issue by making use of nested divs with float property. HTML5 does not encourage nested tables for layout design. Ref to this link for more details. Thanks Jennifer, you made my day.
Below is my code changes
<div id="header" class="clearfix">
<div id="sitetitle" style="float:left">
<a href="/Publication/Config/title">
<img src="/images/site-title.gif" alt="site-title" , title="site-title" id="img-site-title" />
</a>
</div>
<div id="logo" style="float:right">
<a href="/Publication/Config/logo">
<img src="/images/site-logo.gif" alt="site-logo" , title="site-logo" id="img-site-logo" />
</a>
</div>
<div id="bannerad" style="float:left">
<a href="/Publication/Config/fullbanner">
<img src="/images/fullbanner.gif" alt="fullbannerad" , title="fullbannerad" id="img-fullbannerad" />
</a>
</div>
<div id="halfbannerad" style="float:right">
<a href="/Publication/Config/halfbanner">
<img src="/images/halfbanner.gif" alt="halfbannerad" , title="halfbannerad" id="img-halfbannerad" />
</a>
</div>
</div>

Related

Minimize the width of left column to focus on right column of a row HTML / in-line CSS / Markdown

Looking to allocate most of the row space to line up with the container to the right column of a row. I've used
Column1
Column2
This seems to resolve the issue on some online HTML editors, but for some reason, it has no effect on the internal editor I'm using which is mainly focused on MarkDown / HTML / In-Line CSS
Is there a way that this can be done preferably using in-Line CSS?
<div class="main-container" style="display: flex;">
<div class="image-container">
<img
src="https://lh3.googleusercontent.com/coMv1dl31PCfEs6essJoEUwVryaqKHKQvENdZ_WYpN-PXa8Qfitkg3grQxIVN22W5A"
hspace="50" width="150" height="150">
</div>
<div class="content-container" style="width: 600px;">
<h3>Subject Title</h3>
<h4>Subject Description</h4>
<table>
<tr>
<td>
<p>
<center><span style="font-weight:bold">Sample Service</span></center>
</p>
</td>
<td>Sample Service Details Will be listed here!!!!!!!!!!!</td>
</tr>
<tr>
<td>
<p>
<center><span style="font-weight:bold">Contact Us</span></center>
</p>
</td>
<td style="padding-left: 20px;">
<ul style="padding-left: 15px; margin: 0;">
<li style="padding-bottom: 10px;">
Email Sample
</li>
<li><a>Skype: Sample Contact</a></li>
</ul>
</td>
</tr>
</table>
</div>
</div>

The id I set in Google Sites for an image doesn't work

Every time I try to add an id to an image in my html script, for my google site, and save the changes it disappears from the html script. Here is an example of what I want:
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto">
<table cellspacing="0">
<tbody>
<tr>
<td style="background-color:rgb(243,243,243);width:320px;height:131px"> Welcome!<br>
<hr style="color:#f3f3f3;background-color:#00b0f0;height:2px;width:100%">
<ol><li>Introduction</li>
<li>Contacts & Their Roles</li>
<li>Regular Tasks & Deadlines</li>
<li>Priorities/Initiatives of 2017</li>
<li>AMERA Finance & Accounting Guidelines</li>
</ol>
</td>
</tr>
</tbody>
</table>
</div>
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto"><br>
</div>
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto"><img id="intro" border="0" src="https://sites.google.com/imagelink" style="display:block;margin-right:auto;margin-left:auto;text-align:center"></div>
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto">
<div style="text-align:center"><br>
</div>
<img id="contacts" border="0" src="https://sites.google.com/imagelink" style="display:block;margin-right:auto;margin-left:auto;text-align:center">
<div></div>
<br>
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto"></div>
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto">
<div style="text-align:center"></div>
<div style="text-align:center">
<div style="text-align:left">
<img id="tasks" border="0" src="https://sites.google.com/imagelink" style="display:block;margin-right:auto;margin-left:auto;text-align:center"></div>
<div style="text-align:left"><br>
</div>
</div>
<img id="initiatives" border="0" src="https://sites.google.com/imagelink" style="display:block;margin-right:auto;margin-left:auto;text-align:center">
<br>
</div>
<br>
<div><br>
</div>
</div>
The issue is that when I enter that into my html script it comes out as this:
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto">
<table cellspacing="0">
<tbody>
<tr>
<td style="background-color:rgb(243,243,243);width:320px;height:131px"> Welcome!<br>
<hr style="color:#f3f3f3;background-color:#00b0f0;height:2px;width:100%">
<ol><li>Introduction</li>
<li>Contacts & Their Roles</li>
<li>Regular Tasks & Deadlines</li>
<li>Priorities/Initiatives of 2017</li>
<li>AMERA Finance & Accounting Guidelines</li>
</ol>
</td>
</tr>
</tbody>
</table>
</div>
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto"><br>
</div>
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto"><img border="0" src="https://sites.google.com/imagelink" style="display:block;margin-right:auto;margin-left:auto;text-align:center"></div>
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto">
<div style="text-align:center"><br>
</div>
<img border="0" src="https://sites.google.com/imagelink" style="display:block;margin-right:auto;margin-left:auto;text-align:center">
<div></div>
<br>
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto"></div>
<div style="text-align:left;display:block;margin-right:auto;margin-left:auto">
<div style="text-align:center"></div>
<div style="text-align:center">
<div style="text-align:left">
<img border="0" src="https://sites.google.com/imagelink" style="display:block;margin-right:auto;margin-left:auto;text-align:center"></div>
<div style="text-align:left"><br>
</div>
</div>
<img border="0" src="https://sites.google.com/imagelink" style="display:block;margin-right:auto;margin-left:auto;text-align:center">
<br>
</div>
<br>
<div><br>
</div>
</div>
I don't know why it does this, I am probably making a basic mistake and could really use any help!
I have solved the issue with the help of a friend. To solve this issue you just add a section before your <img> with <a name="anchorname"></a>. As an id="anchorname" doesn't work in Google Sites.
Then you just need to make the hyperlink for this section be https://sitename.com/pagename#anchorname
Hope this helps anybody needing the answer to my previous question.

Div overflowing

I have created a jsfiddle here:
http://jsfiddle.net/sawaira/owkvq9bo/8/
<table>
<tr>
<td class="navbar-text">RunAs:</td>
<td>
<input type="text" id="RunAs" class="form-control" value="" onchange="onchangeRunAs()" onkeypress="searchKeyPress(event)" />
</td>
<td>
<ul class="nav navbar-nav navbar-right">
<li class="navbar-text">
</li>
<li>
Sign out
</li>
</ul>
</td>
</tr>
</table>
</div>
</div>
</div>
<div style="float:left; background-color:#222222; height:100%; width:70px; position:fixed;">
<br />
<center><img src="../../Content/images/.png" title="abc" /></center><br /><br />
<center><img src="../../Content/images/time.png" title="adfa-Balance" /></center><r />
/>
/>
</div>
</div>
<div class="container body-content" id="content" style="margin-left:70px;width:1700px">
<table cellpadding="0">
<tr valign="bottom">
<td><img src="../../Content/images/cal48.png"></td>
<td><h2><span class="label label-primary">My Personal Dashboard</span></h2></td>
</tr>
</table>
<body>
<div >
<!-- This is the HTML element that will be used to render the KeyLines component -->
<div id="page" class="pagestyle">
</div>
<div style="position:relative;height:700px; width:1500px;">
<div id="loading" style="position:absolute;height:700px; width:1200px;">
<marquee id="loading-image" behavior="alternate" scrollamount="30">Initializing</marquee>
</div>
<div id="kl" style="position:relative;height:700px; width:1200px;float:left;border: 2px solid #0094ff;overflow:hidden" class="listControl" >
<div style="clear:both;"></div>
</div>
Essentially, on scrolling the blue borders overlap with the nav bar. I do not want this to happen, but not sure what is the cause.
I cannot change the height/width to be auto, as it has to meet some requirements.Otherwise the page does not display the contents properly.
All help will be greatly appreciated.

How do you change containers with HTML buttons?

So I have this code:
<body bgcolor="#FFF">
<table class="body-wrap">
<tr>
<td class="container">
<div class="content">
<div id="logo">
<img src="https://example.com/images/pic.png" />
</div>
<form action=""style="text-align:center;">
<input type="button" value="News"> <input type="button" value="Twitter"> <input type="button" value="Issues"> <input type="button" value="Info">
</form>
<td class ="container">
<div class="content">
<div id="feed"></div>
<img src="http://example.com/images/icon_twitter.png" alt=""> Follow us on Twitter
</div>
</td>
<td class ="container">
<div class="content">
<div id="feed"></div>
<img src="http://example.com/images/icon_twitter.png" alt=""> Follow us on Twitter
</div>
</td>
</div>
</td>
</tr>
</table>
</body>
And I need a way switch between the two containers that are next to one another by clicking the buttons News and Twitter. (I have intentionally left them identical for this example) Later I will add containers for Issues and Info as well. If anyone knows how to do this I would appreciate it if you would tell me. I'm fairly new to HTML so if you could keep your explanations simple that would help as well. Also I would prefer to keep all the code in one HTML file

I am not sure how to convert my webpages Table over to divs instead

I have this table on my website and I am wanting to switch it over to use divs instead but I am still working on studying HTML and am not sure how to go about it. I have a css called theme.css and I know that somthing goes in it to cause this to work.
<table>
<tr>
<td>
<table>
<tr>
<td class="cellWidth">
<img src="4-cute-cats.jpg" class="centerImage" width="300" height="300" />
<p class="centerText">They hunt in packs.</p>
</td>
<td>
<img src="cat_sniping.jpg" class="centerImage" width="256" height="192" />
<p class="centerText">Sniper Cat</p></a>
</td>
<td class="cellWidth">
<img src="LOL1.jpg" class="centerImage" width="300" height="298" />
<p class="centerText">Sneaking Cat</p>
</td>
<td class="cellWidth">
<img src="hammercat.jpg" class="centerImage" width="300" height="163" />
<p class="centerText">80s Cat</p>
</td>
</tr>
<tr>
<td class="cellWidth">
<img src="kittytrap.jpg" class="centerImage" width="200" height=492 />
<p class="centerText">It's a trap!</p>
</td>
<td class="cellWidth">
<img src="chop-cats.jpg" class="centerImage" width="300" height="140" />
<p class="centerText">They can strip a car to the frame in under 2:00 minutes.</p>
</td>
<td class="cellWidth">
<img src="smartkat.jpg" class="centerImage" width="200" height="338" />
<p class="centerText">Intelligent cat.</p></a>
</td>
<td class="cellWidth">
<img src="narniacat.jpg" class="centerImage" width="200" height="337" />
<p class="centerText">Once a cat of Narnia always a cat of Narnia.</p>
</td>
</tr>
<tr>
<td class="cellWidth">
<img src="lolcats3.jpg" class="centerImage" width="300" height="108" />
<p class="centerText">Tired cat.</p>
</td>
<td class="cellWidth">
<img src="lol_cats_1.jpg" class="centerImage" width="300" height="142" />
<p class="centerText">Gollum Cat.</p>
</td>
<td class="cellWidth">
<img src="Magical-Kitty.png" class="centerImage" width="300" height="180" />
<p class="centerText">Super Cat.</p>
</td>
<td class="cellWidth">
<img src="sad-kitty.jpg" class="centerImage" width="300" height="188" />
<p class="centerText">Sad Kitty.</p>
</td>
</tr>
<tr>
<td class="cellWidth">
<img src="cat-in-your-wallpaper.jpg" class="centerImage" width="300" height="200" />
<p class="centerText">Wallpaper cat.
</td>
<td class="cellWidth">
<img src="thinking-cat.jpg" class="centerImage" width="300" height="475" />
<p class="centerText">Thinking cat.</p>
</td>
<td class="cellWidth">
<img src="http://3.bp.blogspot.com/_znuneBeHigk/TSOOr5DuoQI/AAAAAAAABFY/-Rpe8S1uRo8/s1600/000.jpg&w=823&h=618&ei=_A4VUfP7L4Gy2QXJ-oHIDQ&zoom=1&ved=1t:3588,r:79,s:0,i:354&iact=rc&dur=2621&sig=108293906633680688065&page=3&tbnh=172&tbnw=231&start=67&ndsp=38&tx=64&ty=72" class="centerImage" width="300" height="225" />
<p class="centerText">Gamer Kitty.</p>
</td>
<td class="cellWidth">
<img src="http://www.dumpaday.com/wp-content/uploads/2013/01/funny-lol-cats-playing-with-toilet-paper1.jpg" class="centerImage" width="300" height="504" />
<p class="centerText">Couch cat.</p>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
More Kitties
</td>
</tr>
</table>
Have look at using framework like bootstrap it will help by giving you a base set of CSS to work with, making the transition a bit easier.
You html above isn't too wrong, the rule of thumb would be don't use tables for page layout (like your outer table) but its okay to use it for tabular data. (like lists of data)
Using the bootstrapframework.
You could easily change it to something like:
<div class="container"> <--- Would be in your base template
<div class="row">
<div class="span8">
<table>
... Your tabular data
</table>
</div>
<div class="span4">
More Kitties
</div>
</div>
So if you break it down, the HTML code involves two tables nested within each other:
<table>
<tr>
<td>
<table> ... </table>
</td>
</tr>
<tr>
<td>
...
</td>
</tr>
</table>
This appears to control the layout, making sure that the inner table appears on the top, and the 'more kitties' link below.
This can be removed entirely:
<table> <!-- inner table --> </table>
<p class="centered">More Kitties</p>
Using css:
.centered {
text-align: center;
}
I would suggest leaving that inner table (the one with the cat pictures) as a table, since it is actually image data. (Demo)
If you really want to transform the inner table into <div>s, then I'd suggest the following:
Take every cell (<td>) and convert that to a <div>
Style each <div> with display:inline-block;. This will cause them to appear next to each other (inline) but still have explicit sizing (block).
See this demo as an example. I only included the first two rows of cat pictures. Notice that the number of elements in each "row" depends on the available horizontal width and how wide each picture is. If you specify an explicit width on the wrapper, and explicit widths on the <div>s, then you can control how many appear in each row.
Another thing to remember is that the inline-block CSS property value won't work with the older IE browsers. (6 and 7, for certain. I'm not sure about IE8 support.)
demo: http://jsfiddle.net/kLmpV/
Here is a starting point. See if you can understand this, and convert your table into a layout similar.
html
<div class="wrapper">
<article>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</article>
<article>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</article>
<article>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</article>
<article>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</article>
<article>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</article>
</div>
css
.wrapper {
margin: 1%;
background: #f5f5f5;
overflow: hidden;
}
.item {
height: 200px;
float: left;
display: inline-block;
width: 23%;
position: relative;
background: pink;
margin: 1%;
}