CSS show/hide div on-click in SharePoint 2007 - html

I'm trying to save page length in SharePoint by having a list of links that expose corresponding copy directly below them onto the page.
I have this working great outside of SharePoint thanks to the labels solution in this question and once in SP it works fine in Chrome but the hidden divs don't expand when the links are clicked in IE11.
To get around SP stripping the formatting away I created a .txt file containing the CSS and HTML and uploaded it to the sites style library. Then linked to it in a Content Editor Webpart. you can see what I'm using in the demo.
I'd like a solution without using JQuery as I'm not sure if we can use it within our internal enviroment (I've asked if we can but haven't heard back yet) It seems logical that there must be a simple way to do this within SP itself or SharePoint Designer or CSS without the above issue?
.artifact_top
{padding:10px;border:1px solid lightgrey;margin:10px;overflow:auto;}
.collapse{
cursor: pointer;
display: block;
color: #6490d6;
text-decoration: none;
}
.collapse:hover{
text-decoration: underline;
}
.collapse + input{
display: none; /* hide the checkboxes */
}
.collapse + input + div{
display:none;
}
.collapse + input:checked + div{
display:block;
}
table
{border-collapse:separate;width:100%;border:none;}
td
{padding-left:10px;padding-top:10px;vertical-align:top;}
<div style="float: right; width: 35%; padding-left: 5%;"><div class="ms-rteFontSize-2" style="border-bottom: 1px solid orange; margin: 4px; padding: 4px;"><strong style="font-size: 13.3333px;">Implementation</strong><strong> Artifacts</strong></div>
<br/>
<span class="ms-rteFontSize-1">This topic provides you a list of the artifacts and supporting documentation related to <span>Implementation</span>. Artifacts with an asterisk are required for all projects.</span>
<br/><br/>
<div><label class="collapse" for="_1">Final Implementation Plan*</label>
<input id="_1" type="checkbox"/>
<div class="artifact_top">The Implementation Plan identifies tasks, owners, timeline, and communication for IT components of the Implementation phase.<br/><br/>
<table>
<tbody><tr>
<td width="50%"><strong>Artifact Owner</strong><br/>PM</td>
<td width="50%"><strong>Template</strong><br/>View the Implementation Plan template.</td>
</tr>
<tr>
<td width="50%"><strong>Approver</strong><br/>Delivery Lead, PM, Release Manager</td>
<td width="50%"><strong>Sample</strong><br/>N/A</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
<div><label class="collapse" for="_2">Operational Readiness Review (ORR)*</label>
<input id="_2" type="checkbox"/>
<div class="artifact_top">The Operational Readiness Review is a checklist to ensure all required documentation listed within the ORR is completed.<br/><br/>
<table>
<tbody><tr>
<td width="50%"><strong>Artifact Owner</strong><br/>App Services</td>
<td width="50%"><strong>Template</strong><br/>View the Operational Readiness Review template.</td>
</tr>
<tr>
<td width="50%"><strong>Approver</strong><br/>App Services</td>
<td width="50%"><strong>Sample</strong><br/>N/A</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
<div><label class="collapse" for="_3">System/Application Documentation*</label>
<input id="_3" type="checkbox"/>
<div class="artifact_top">The System/Application Documentation consolidates content about the system/application, which backend users can use to determine how that system/application is designed and functions. <br/><br/>
<table>
<tbody><tr>
<td width="50%"><strong>Artifact Owner</strong><br/>TechComm</td>
<td width="50%"><strong>Template</strong><br/>N/A</td>
</tr>
<tr>
<td width="50%"><strong>Approver</strong><br/>IT Configuration Management</td>
<td width="50%"><strong>Sample</strong><br/>N/A</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
</div>

To support some advanced functionality in Internet Explorer, SharePoint 2010 uses some ActiveX controls that are only available in IE8. SharePoint forces Internet Explorer 11 into compatibility view to emulate Internet Explorer 8, essentially downgrading your version of IE.
Unfortunately, the input:checked CSS selector was introduced with CSS 3 and was not yet available in Internet Explorer 8.
As an alternative, you can use a click event handler in JavaScript to toggle the visibility of the divs. JavaScript can be entered into the same .txt file as your CSS and HTML (enclosed within <script> tags). If you put the JavaScript below your HTML, it will not execute until the preceding HTML is loaded by the browser, allowing you to query and reference the preceding HTML elements in your script.
<script>
var labels = document.querySelectorAll(".collapse"); // get all labels
for(var i = 0; i < labels.length; i++){
var label = labels[i];
(function(div){
label.onclick = function(){
if(div.style.display == "block"){
div.style.display = "none";
}else{
div.style.display = "block";
}
};
})(label.parentNode.querySelector("div"));
}
</script>
var labels = document.querySelectorAll(".collapse"); // get all labels
for (var i = 0; i < labels.length; i++) {
var label = labels[i];
(function(div) {
label.onclick = function() {
if (div.style.display == "block") {
div.style.display = "none";
} else {
div.style.display = "block";
}
};
})(label.parentNode.querySelector("div"));
}
.collapse {
cursor: pointer;
display: block;
color: #6490d6;
text-decoration: none;
}
.collapse:hover {
text-decoration: underline;
}
.collapse + input {
display: none;
/* hide the checkboxes */
}
.collapse + input + div {
display: none;
}
table {
border-collapse: separate;
width: 100%;
border: none;
}
td {
padding-left: 10px;
padding-top: 10px;
vertical-align: top;
}
.artifact_top {
padding: 10px;
border: 1px solid lightgrey;
margin: 10px;
overflow: auto;
}
<div style="float: right; width: 35%; padding-left: 5%;">
<div class="ms-rteFontSize-2" style="border-bottom: 1px solid orange; margin: 4px; padding: 4px;"><strong style="font-size: 13.3333px;">Implementation</strong><strong> Artifacts</strong>
</div>
<br/>
<span class="ms-rteFontSize-1">This topic provides you a list of the artifacts and supporting documentation related to <span>Implementation</span>. Artifacts with an asterisk are required for all projects.</span>
<br/>
<br/>
<div>
<label class="collapse" for="_1">Final Implementation Plan*</label>
<input id="_1" type="checkbox" />
<div class="artifact_top">The Implementation Plan identifies tasks, owners, timeline, and communication for IT components of the Implementation phase.
<br/>
<br/>
<table>
<tbody>
<tr>
<td width="50%"><strong>Artifact Owner</strong>
<br/>PM
</td>
<td width="50%"><strong>Template</strong>
<br/>View the Implementation Plan template.</td>
</tr>
<tr>
<td width="50%"><strong>Approver</strong>
<br/>Delivery Lead, PM, Release Manager</td>
<td width="50%"><strong>Sample</strong>
<br/>N/A</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
<div>
<label class="collapse" for="_2">Operational Readiness Review (ORR)*</label>
<input id="_2" type="checkbox" />
<div class="artifact_top">The Operational Readiness Review is a checklist to ensure all required documentation listed within the ORR is completed.
<br/>
<br/>
<table>
<tbody>
<tr>
<td width="50%"><strong>Artifact Owner</strong>
<br/>App Services</td>
<td width="50%"><strong>Template</strong>
<br/>View the Operational Readiness Review template.</td>
</tr>
<tr>
<td width="50%"><strong>Approver</strong>
<br/>App Services</td>
<td width="50%"><strong>Sample</strong>
<br/>N/A</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
<div>
<label class="collapse" for="_3">System/Application Documentation*</label>
<input id="_3" type="checkbox" />
<div class="artifact_top">The System/Application Documentation consolidates content about the system/application, which backend users can use to determine how that system/application is designed and functions.
<br/>
<br/>
<table>
<tbody>
<tr>
<td width="50%"><strong>Artifact Owner</strong>
<br/>TechComm</td>
<td width="50%"><strong>Template</strong>
<br/>N/A</td>
</tr>
<tr>
<td width="50%"><strong>Approver</strong>
<br/>IT Configuration Management</td>
<td width="50%"><strong>Sample</strong>
<br/>N/A</td>
</tr>
</tbody>
</table>
</div>
</div>
<br/>
</div>

pure css and html, nice work!
have you the possibility to add a meta into the header?
see / try the ie=edge meta:
What does <meta http-equiv="X-UA-Compatible" content="IE=edge"> do?
we got a lot of issues with our sharepoint / our ie version on our workmachines - css styles are ignored, scripts not working etc.
are the contents always hidden and the click has no effect or are they alwasy visible?

Related

String Manipulation with CSS in Mail (hack)

Is there a simple way to remove or make invisible two characters from the beginning of a string using just html and css? You can keep for yourself the downvotes to the questions... I know it's a hack.
I'm using mailchimp to send abandoned cart reminder mails. The price of a product is displayed as
zl123
but I need to display it as
123 zl
I tried to change the settings of the money format, but I haven't found a solution, so I'll try to hack it in some other way. Mailchimp replaces automatically a placeholder so I have to process what they put instead of the price placeholder, I have no control on that.
I have an html mail template and I can use css with it but no javascript. If you know how to solve the format problem in the mailchimp settings directly it will also work of course. Any help is very appreciated.
This is the product list code and the tag is *|PRODUCT:PRICE|*:
*|ABANDONED_CART:[$total=3]|*
<table>
<tbody>
<tr>
<td rowspan="3" style="vertical-align:top" valign="top" width="80"><img src="*|PRODUCT:IMAGE_URL|*" /> </td>
<td style="padding: 10px 30px"><a class="ab-cart__name" href="*|CART:URL|*" target="_blank">*|PRODUCT:TITLE|*:</a></td>
</tr>
<tr>
<td style="padding: 10px 30px"><a class="ab-cart__price" href="*|CART:URL|*" target="_blank">*|PRODUCT:PRICE|*</a></td>
</tr>
<tr>
<td style="padding: 10px 30px">
<table cellpadding="0" cellspacing="0" style="background:#bed22c;">
<tbody>
<tr>
<td align="center" style="padding:9px 20px; padding-right:5px" valign="middle"><a class="ab-cart__button" href="*|CART:URL|*" target="_blank"><img class="ab-cart__icon" data-file-id="1415814" height="13" src="https://gallery.mailchimp.com/6b8c9d4b13e018d718abc0a65/images/2226adf6-5cc3-4f24-aa98-39825c247c2c.png" width="14" /> </a></td>
<td style="padding:9px 0; padding-right:10px"><a class="ab-cart__button" href="*|CART:URL|*" target="_blank">Zobacz w koszyku </a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
*|END:ABANDONED_CART|*
A hacky way will be fixing and repeating the word twice!
p {
font-size: 20px;
}
.hide-first-two {
text-indent: -0.75em;
overflow: hidden;
display: inline-block;
}
.show-first-two {
width: 0.75em;
overflow: hidden;
display: inline-block;
}
<p>
<span class="hide-first-two">zl123</span>
<span class="show-first-two">zl123</span>
</p>
Or using inline style:
<p style="font-size: 20px;">
<span style="text-indent: -0.75em; overflow: hidden; display: inline-block;">zl123</span>
<span style="width: 0.75em; overflow: hidden; display: inline-block;">zl123</span>
</p>
Considering your text lz123 comming form server and appened in
<p>lz123</p>
You can add text in this <p> by using ::after and ::before css selectors
But if is not possible to remove or manipulate that text in <p> using css
For string manipulation i suggest to use Javascript or Jquery

Why do my pure css tabs cover the divs below?

I'm creating a pure CSS tabbed area as seen on CSS-tricks. Only trouble is, when a larger area is selected, the content below does not move down. There is div position: absolute within a div position: relative. Think this is necessary for the tabbed area to function, and I assumed that because it was wrapped within a relative div, this would not overlap later content.
Please can any suggest how I can edit this to prevent the later content being overlapped? Thank you!
.tabs {
position: relative;
min-height: 200px; /* This part sucks */
clear: both;
margin: 25px 0;
}
.tab {
float: left;
}
.tab label {
background: #eee;
padding: 10px;
border: 1px solid #ccc;
margin-left: -1px;
position: relative;
left: 1px;
}
.tab [type=radio] {
display: none;
}
.content {
position: absolute;
top: 28px;
left: 0;
background: white;
right: 0;
padding: 20px;
border: 1px solid #ccc;
}
[type=radio]:checked ~ label {
background: #000;
color: #fff;
border-bottom: 1px solid white;
z-index: 2;
}
[type=radio]:checked ~ label ~ .content {
z-index: 1;
display: block;
}
[type=radio]:not(:checked) ~ label ~ .content {
display: none;
}
* {
margin: 0;
padding: 0;
}
body {
background: #999;
}
#page-wrap {
width: 960px;
margin: 100px auto;
}
#test {
width: 100%;
text-align: center;
color: #fff;
font-size: 20px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title>Pure CSS Tabbed Areas</title>
<link rel='stylesheet' href='css/style.css'>
</head>
<body>
<div id="page-wrap">
<div class="tabs">
<div class="tab">
<input type="radio" id="tab-1" name="tab-group-1" checked>
<label for="tab-1">Tab One</label>
<div class="content">
<table>
<tbody>
<tr>
<td align="center" valign="top" width="175">
<img src="http://www.zestclothing.co.uk/ebay_stores/1066sales/custom_pages/PayPal_logo_150x65.gif" alt="" border="0">
</td>
<td width="598">
PayPal is our preferred method of payment for UK & overseas customers as it is quick & easy for you and for us.
</td>
</tr>
<tr>
<td align="center" valign="top" width="175">
<img src="http://www.zestclothing.co.uk/ebay_stores/1066sales/custom_pages/phonepay.jpg" alt="" border="0">
</td>
<td width="598">If you prefer not to pay online we accept Credit & Debit card payments over the telephone. Please call us on <strong>---</strong> Monday to Friday between 9am & 4pm UK time. We will need your eBay User ID or an Item Number to find your order. We accept all major Credit & Debit cards except American Express.
</td>
</tr>
<tr>
<td>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="tab">
<input type="radio" id="tab-2" name="tab-group-1">
<label for="tab-2">Tab Two</label>
<div class="content">
<table>
<tbody>
<tr>
<td align="center" valign="top" width="175">
<img src="http://www.zestclothing.co.uk/ebay_stores/1066sales/custom_pages/rm.jpg" alt="" border="0">
<br><br>
<img src="http://www.zestclothing.co.uk/ebay_stores/1066sales/custom_pages/specdel.jpg" alt="" border="0">
<br><br>
<img src="http://www.zestclothing.co.uk/ebay_stores/1066sales/custom_pages/airmail.jpg" alt="" border="0">
<br><br>
<img src="http://www.zestclothing.co.uk/ebay_stores/1066sales/custom_pages/parcelforceww.jpg" alt="" border="0">
</td>
<td width="598">
The majority of our prices include standard UK delivery, this will normally be by the Royal Mail 48, Royal Mail Tracked 48 or Royal Mail 48 Signed For services. For multiple orders that have been paid for individually we may combine orders into one package so you receive all your items together.
<br><br>
We realise that when you place an order you want it now not in a weeks time! We aim to post items the same day we receive cleared payment Monday to Friday, otherwise we post items the next working day. We post orders in plain plastic mailing bags or boxes. When your order is dispatched we will send you an email to let you know. Royal Mail collect from us each weekday afternoon and most UK customers receive their orders within two days. Please check our feedback to see what customers say about the speed of our delivery.
<br><br>
If you need guaranteed next day delivery we can send your order by Royal Mail Special Delivery which will be delivered by 1pm.
<br><br>
We ship worldwide by Royal Mail Airmail and Parcel Force Worldwide so please contact us for a price to your country.
<br><br>
Overseas buyers are responsible for any tax & import duty charged when goods are imported to your country.
<br><br>
If you want to collect your order from our warehouse in Rye, East Sussex we are happy to accommodate, please email cs#zestclothing.co.uk to arrange a convenient time.
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="tab">
<input type="radio" id="tab-3" name="tab-group-1">
<label for="tab-3">Tab Three</label>
<div class="content">
<p>We realise that clothing sizes differ from one manufacturer to another so if your purchase does not fit we can help you to find an alternative size or product. We are happy to exchange items within 30 days of purchase providing that they are returned in the same condition as when they left us with all the tags and packaging.
<br><br>
There is no need to contact us before returning an item.
<br><br>
If you post an item to us then please include the original paperwork or a copy. Please write on the paperwork the reason for return & whether you would like an alternative size, an alternative product or a refund. Please post returns to:</p>
<table>
<tbody>
<col width="30px" />
<col width="742px" />
<tr>
<td>
</td>
<td>
<strong>---<br>
---<br>
---<br>
---<br>
---<br>
---<br>
---</strong>
<br><br>
</td>
</tr>
</tbody>
</table>
<p>We recommend that you obtain a free proof of posting from the Post Office when sending returns. Customers are responsible for the return postage cost.</p>
</div>
</div>
</div>
</div>
<div id="test">
<p>This should move down, but it gets covered!</p>
</div>
</body>
</html>

HTML-find in page and display ONLY relevant portion

Ok, the title may sound a bit easy or common but my problem is not that easier. I'm working on making a HTML page that displays a database in table rows. A sample code is:
<table>
<tr><td>ABC Hospitals</td></tr>
<tr><td>India</td><td>Contact:9999999999</td></tr>
</table>
<table>
<tr><td>XYZ Blood Bank</td></tr>
<tr><td>NewJersey</td><td>Contact:8888888888</td></tr>
</table>
<table>
<tr><td>ABC Inn</td></tr>
<tr><td>California</td><td>Contact:7777777777</td></tr>
</table>
I have used tables to group data, with each one containing rows to display data. The code gives the following output sample, with the CSS effects added:
Image1 - Sorry, I'm a new user and StackOverflow doesn't allow me to post images.
I'm now in requirement of a 'Find in page' box to search the HTML document for a specific piece of information(say "ABC"). The search must display ONLY the table(s) that contains the query term("ABC"), in our case, hiding ALL other tables which do not contain the search term. I have achieved the sample output by manually editing the HTML, just to more clearly show my requirement. I'm in need of the JScript(or any appropriate) code to achieve the result:
Image2 - Sorry again.
I'm sure somebody here will be able to help me, either provide me some code piece or guiding me to some useful link. Thanks in advance.
-Sriram
var search = document.querySelector('#search');
var database = document.querySelector('#database');
search.addEventListener('input', function (e) {
// Every time the input changes, execute filterMatching.
filterMatching(search.value, database);
});
function filterMatching(value, parent) {
// Get the parent's children into an array
var children = [].slice.call(parent.children);
// Everything is shown by default.
children.forEach(function removeHiddenFromAll(child) {
child.classList.remove('hidden');
});
// Find those who are not matching
children.filter(function findNonMatching(child) {
// the toLowerCase() on both ensures the search is not case sensitive.
return child.textContent.toLowerCase().indexOf(value.toLowerCase()) < 0;
})
// After we found all the non matching, hide them
.forEach(function hideNonMatching(nonMatching) {
nonMatching.classList.add('hidden');
});
}
.hidden {
display: none;
}
<input type="text" id="search" />
<div id="database">
<table>
<tr>
<td>ABC Hospitals</td>
</tr>
<tr>
<td>India</td>
<td>Contact:9999999999</td>
</tr>
</table>
<table>
<tr>
<td>XYZ Blood Bank</td>
</tr>
<tr>
<td>NewJersey</td>
<td>Contact:8888888888</td>
</tr>
</table>
<table>
<tr>
<td>ABC Inn</td>
</tr>
<tr>
<td>California</td>
<td>Contact:7777777777</td>
</tr>
</table>
</div>
Never mind, for some reason, the thing doesn't work when the element are stored as 'var' types. So I modified the code slightly as follows: I created a new function:
function fn_search(){
var phrase = document.querySelector('#search').value;
filterMatching(phrase, document.querySelector('#database'));
}
and called
<input type="text" id="search" oninput="fn_search()" />
The program now works fine.
The complete code is below:
<html>
<head>
<style>
table{
padding: 20px;
margin: 10px;
background: #990030;
color: #fff;
font-size: 17px;
font-weight: bold;
line-height: 1.3em;
border: 2px dashed #9ff;
border-radius: 10px;
box-shadow: 0 0 0 4px #990030, 2px 1px 6px 4px rgba(10, 10, 0, 0.5);
text-shadow: -1px -1px #aa3030;
font-weight: normal;
table-layout: fixed;
width: 325px;
height:75px;
}
th, td {
overflow: hidden;
width: 100px;
}
table.hidden {
display: none;
}
</style>
</head>
<body>
<script>
function fn_search(){
var phrase = document.querySelector('#search').value;
filterMatching(phrase, document.querySelector('#database'));
}
function filterMatching(value, parent) {
// Get the parent's children into an array
var children = [].slice.call(parent.children);
// Everything is shown by default.
children.forEach(function removeHiddenFromAll(child) {
child.classList.remove('hidden');
});
// Find those who are not matching
children.filter(function findNonMatching(child) {
// the toLowerCase() on both ensures the search is not case sensitive.
return child.textContent.toLowerCase().indexOf(value.toLowerCase()) < 0;
})
// After we found all the non matching, hide them
.forEach(function hideNonMatching(nonMatching) {
nonMatching.classList.add('hidden');
});
}
</script>
<input type="text" id="search" oninput="fn_search()" />
<div id="database">
<table>
<tr>
<td>ABC Hospitals</td>
</tr>
<tr>
<td>India</td>
<td>Contact:9999999999</td>
</tr>
</table>
<table>
<tr>
<td>XYZ Blood Bank</td>
</tr>
<tr>
<td>NewJersey</td>
<td>Contact:8888888888</td>
</tr>
</table>
<table>
<tr>
<td>ABC Inn</td>
</tr>
<tr>
<td>California</td>
<td>Contact:7777777777</td>
</tr>
</table>
</div>
</body>
</html>

css class styles not applied

I've some code like this:
<div class="divleft">
<TABLE class="form-table">
<TR class="heading">
<TD colspan="2" align="left">
<h3>Account description</h3>
</td>
</tr>
<TR>
<TD>Name</TD>
<TD><input name="Naam" id="Naam" type="text" class="InputText" /></TD>
</TR>
and a CSS style on the class heading like this (for testing purposes, not actual styling)
.form-table tr.heading{
border-bottom-width: 10px;
border-bottom-color:black;
}
However, this style is being ignored. When I inspect the element with google chrome tools I cannot see any other stylesheet element that could affect this.
Any ideas on what could be causing this issue?
border-style is missing
.heading{
border-bottom-width: 10px; border-style:solid;
border-bottom-color:black;
}​
You can write in single line like this
.heading{
border-bottom: 10px solid black;
}​

how to make a cell of table hyperlink

How can entire table cell be hyperlinked in html without javascript or jquery?
I tried to put href in td tag itself but its not working at least in chrome 18
<td href='http://www.m-w.com/dictionary/' style="cursor:pointer">
Try this:
HTML:
<table width="200" border="1" class="table">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
CSS:
.table a
{
display:block;
text-decoration:none;
}
I hope it will work fine.
Try this way:
<td> </td>
Easy with onclick-function and a javascript link:
<td onclick="location.href='yourpage.html'">go to yourpage</td>
Why not combine the onclick method with the <a> element inside the <td> for backup for non-JS? Seems to work great.
<td onclick="location.href='yourpage.html'">Link</td>
Here is my solution:
<td>
<div class="item-container">
<img class="icon" src="/iconURL" />
<p class="name">
SomeText
</p>
</div>
</td>
(LESS)
td {
padding: 1%;
vertical-align: bottom;
position:relative;
a {
height: 100%;
display: block;
position: absolute;
top:0;
bottom:0;
right:0;
left:0;
}
.item-container {
/*...*/
}
}
Like this you can still benefit from some table cell properties like vertical-align.(Tested on Chrome)
Problems:
(User: Kamal) It's a good way, but you forgot the vertical align problem! using this way, we can't put the link exactly at the center of the TD element! even with vertical-align:middle;
(User: Christ) Your answer is the best answer, because there is no any align problem and also today JavaScript is necessary for every one... it's in every where even in an old smart phone... and it's enable by default...
My Suggestion to complete answer of (User: Christ):
HTML:
<td style="cursor:pointer" onclick="location.href='mylink.html'"><a class="LN1 LN2 LN3 LN4 LN5" href="mylink.html" target="_top">link</a></td>
CSS:
a.LN1 {
font-style:normal;
font-weight:bold;
font-size:1.0em;
}
a.LN2:link {
color:#A4DCF5;
text-decoration:none;
}
a.LN3:visited {
color:#A4DCF5;
text-decoration:none;
}
a.LN4:hover {
color:#A4DCF5;
text-decoration:none;
}
a.LN5:active {
color:#A4DCF5;
text-decoration:none;
}
you can give an <a> tag the visual behavior of a table cell:
HTML:
<table>
<tr>
Cell 1
<td>Cell 2</td>
</tr>
</table>
CSS:
tr > a {
display: table-cell;
}
I have seen this before when people are trying to build a calendar. You want the cell linked but do not want to mess with anything else inside of it, try this and it might solve your problem.
<tr>
<td onClick="location.href='http://www.stackoverflow.com';">
Cell content goes here
</td>
</tr>
Not exactly making the cell a link, but the table itself. I use this as a button in e-mails, giving me div-like controls.
<a href="https://www.foo.bar" target="_blank" style="color: white; font-weight: bolder; text-decoration: none;">
<table style="margin-left: auto; margin-right: auto;" align="center">
<tr>
<td style="padding: 20px; height: 60px;" bgcolor="#00b389">Go to Foo Bar</td>
</tr>
</table>
</a>
If you want use this way in php Do the following
<?php
echo ("
<script type = 'text/javascript'>
function href() {
location.href='http://localhost/dept';
}
</script>
<tr onclick='href()'>
<td>$id</td>
<td>$deptValue</td>
<td> $month </td>
<td>100%</td>
</tr>
");
?>