Text-decoration: none using table --having trouble - html

Although this may seem trivial to most of you, for some I can't get the text-decoration:none apply in a table cell as shown in the below.
What am I doing wrong with my css?
Any inputs will be greatly appreciated
table{
font-size: 50px;
}
table a{
text-decoration: none;
}
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" rel="stylesheet"/>
<div>
<table>
<tbody>
<tr>
<td>
<i class="fa fa-quote-left" aria-hidden="true"></i>
<p>Quote Master</p>
</td>
</tr>
</tbody>
</table>
</div>

If you want the black color, apply color: inherit to the anchor tag.
Generally the color of the anchor tag is 'purple'(#0000EE;), if you see any where,
Eg: google search results all links consists purple color links.
If we apply color: 'inherit', the parent's color will be applied to the anchor overriding the default color, if it also not black, you can explicitly declare color: 'black' to that anchor.
table{
font-size: 50px;
}
table a{
text-decoration: none;
color: inherit
}
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" rel="stylesheet"/>
<div>
<table>
<tbody>
<tr>
<td>
<i class="fa fa-quote-left" aria-hidden="true"></i>
<p>Quote Master</p>
</td>
</tr>
</tbody>
</table>
</div>

Related

Bootstrap table one column exiled way over to the left

I wanted to add an icon with a tooltip to a bootstrap table and wow I have failed miserably. it seems to be aligning the flair way over on the left and I would like it to be closer to the thing that the icon/tooltip refers to.
So if you look at this link:
JSFIDDLE
You should notice that no matter how big the table is, the "CPU" column is pushing the column to the left of it all the way over to the left margin of the table.
(this is an image of what it looks like when font awesome actually works)...The image shows the insane gap between the 'flair' and the CPU description. Does anyone know why it is giving the CPU column such an insane berth?
enter link description here
.product-table {
margin-top: 50px;
th {
color: $dark-gray;
padding: 20px 7px;
i {
color: $green;
font-size: 26px;
}
}
a {
color: $text;
&:hover {
color: $green;
text-decoration: none;
}
}
.product-table-body {
border: 1px solid $lightest-gray;
td {
padding: 15px 7px;
}
tr:nth-child(2n+1) {
background-color: $lightest-gray;
}
}
}
<section>
<h2 class="text-center">Things and Stuff</h2>
<div class="table-responsive">
<table class="w-100 text-center product-table">
<tr>
<th></th>
<th><i class="fal fa-microchip"></i><br>CPU</th>
<th><i class="fal fa-database"></i><br>Storage</th>
<th><i class="fal fa-memory"></i><br>RAM</th>
<th><i class="fal fa-desktop"></i><br>IPs</th>
<th><i class="fal fa-tachometer-alt-fast"></i><br>Bandwidth</th>
<th><i class="fal fa-hand-holding-usd"></i><br>Monthly</th>
<th></th>
</tr>
<tr>
<td>
<span style="color: #6e9c23;">
<i class="fal fa-fire fa-2x" data-toggle="tooltip" data-placement="left" title="Recommended"></i>
</span>
</td>
<td>Xeon E3-1245v5 (4x3.5GHz)</td>
<td>1x1TB</td>
<td>16GB</td>
<td>5</td>
<td>10000GB</td>
<td>$89</td>
<td><div class="d-inline-block"><i class="fas fa-chevron-right"></i></div></td>
</tr>
</table>
</div>
</section>
It looks like your column's width is set at a certain percentage of the table. Since the table takes up a percentage of the screen, the column's size can be different on larger/smaller screens. I'd recommend setting a width value for the table so it's the same size on different screens.
Hope this helps.

Google Icon Vertical Alignment Not Working

I am trying to align the "minus" and "plus" sign to the bottom. However, neither the css nor inline style works. By selecting the contents, there is no extra white space in the bottom of the icon.
Why neither css nor the inline-style statement didn't work?
Here below are the codes I tried:
HTML
<tr>
<td style="vertical-align: text-bottom;">
Copies:
<i class="material-icons icons"></i>
<input type="text" id="myNumber" size="1px" value="1" />
<i class="material-icons"></i>
</td>
</tr>
CSS Option 1
material-icons.icons {
vertical-align: text-bottom;
}
CSS Option 2
material-icons.icons {
position: absolute;
bottom: 0;
right: 0;
}
You can consider using a flexbox for the table cell.
td {
display: flex;
align-items: flex-end; /* Vertical alignment at the bottom */
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<table>
<tr>
<td>
Copies:
<i class="material-icons icons"></i>
<input type="text" id="myNumber" size="1px" value="1" />
<i class="material-icons"></i>
</td>
</tr>
</table>
Approach 1 :
PS: #Gerard answer is well accepted as it follows the flexbox which is
a good technique to play with element's alignment, also the answer doesnot
modify the markup as its slightly modified in approach 2.
Approach 2:
Made slight change in html mark-up, - Wrapped the Copies: inside a span tag.
Floated every element, and used line-height to adjust the elements.
td {
height: 20px;
}
td > * {
float: left;
display: inline-block;
height: 100%;
line-height: 20px;
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<table>
<tr>
<td valign="bottom">
<span>Copies:</span>
<i class="material-icons icons"></i>
<input type="text" id="myNumber" size="1px" value="1" />
<i class="material-icons"></i>
</td>
</tr>
</table>
Make different < td > for each of them it will align in proper way. Check the below code :
//Link is to add the material icon (CDN for material Icon) you have do add this in
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<table>
<tr>
<td style="vertical-align: text-bottom;">
Copies:</td>
<td> <i class="material-icons icons"></i> </td>
<td> <input type="text" id="myNumber" size="1px" value="1" /> </td>
<td><i class="material-icons"></i></td>
</td>
</tr>
</table>
Add below css and you're done...
tr>td {
display:table;
}
tr>td>i {
display:table-cell;
vertical-align: bottom;
}

horizontally centering td in html email using inline stlyes

I am writing an html email using inline styles since I'll be sending it in Outlook and read that's the best way to circumvent browser reformatting. I want to center the two links below, which I put into table cells because that's the only way I could get padding to work in Outlook. I would like the 2 links to appear centered with their background and padding on the page, but I don't know how to do that using inline styling and tables. Can anyone help? Thanks!
<!DOCTYPE html>
<html>
<head>
<title>email blast re films</title>
</head>
<body>
<table>
<tr>
<td style="padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px; font-size: 14px; background: #3D87F5; color: white;">
Watch my film "wall cuts, train stations, New York City"
</td>
</tr>
</table>
<table>
<tr>
<td style="padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px; font-size: 14px; background: #3D87F5; color: white;">
Watch my film "red hook, rush hour"
</td>
</tr>
</table>
<table>
<tr>
<td style="font-size: 14px; text-align: center; padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px; background: #3A8E47;">
<a href="http://www.bartonlewisfilm.com" style="display: inline-block; padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px; background: #3A8E47;
text-decoration: none; color: white;" title="visit bartonlewisfilm.com" target="_blank;">bartonlewisfilm.com</a> | home (718) 399-8344 | cell (347) 325-4415
</td>
</tr>
</table>
</body>
</html>
First, instead of using padding on each cell, you can just specify cellpadding attribute for a table tag -
<table cellpadding="10">
The cell content is centered by default -
<table cellpadding="10">
<tr>
<td style="background-color: red;">
Link 1<br/>
Link 2
</td>
</tr>
<tr>
<td style="background-color: red;">
Link 1<br/>
Link 2
</td>
</tr>
</table>
UPD
To center the whole table, set margin to 0 auto -
<table style="margin: 0 auto;">
To center only either a row or a column, apply accordingly -
<tr style="width: 50%; margin: 0 auto; display: table;"></tr>
or
<td style="width: 50%; margin: 0 auto; display: table;"></td>
You add an align attribute to the td cell.
<td align="center" style="padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px; font-size: 14px; background: #3D87F5; color: white;"> Your link
</td>
Adding margin to body tag, will that work for you.
<body style="margin-top:20%;margin-bottom:20%;margin-left:30%;">
Use text-align:center, vertical-align:middle,
table{width:100%;height:100%;}
td{width:100%;height:100%; text-align:center; vertical-align:middle; font-size: 14px; }
a, a:link, a:visited{padding:10px; display:inline-block; color: white; text-decoration: none;margin:10px; background: #3D87F5; }
<!DOCTYPE html>
<html>
<head>
<title>email blast re films</title>
</head>
<body>
<div id="centerme">
<table>
<tr>
<td>
Watch my film "wall cuts, train stations, New York City"
<br/>
Watch my film "red hook, rush hour"
</td>
</tr>
</table>
</div>
</body>
</html>
Check out this html. Appears fine to me.
<!DOCTYPE html>
<html>
<head>
<title>email blast re films</title>
</head>
<body style="height:height:500px;">
<table border="0" style="width:100%; text-align:center;">
<tr>
<td >
<span style="border-radius: 5px;display:block;margin-left:20%;margin-right:20%;margin-top:10%;padding-top:10px;padding-right:10px;padding-bottom:10px; font-size: 14px; background: #3D87F5; color: white;">Watch my film "wall cuts, train stations, New York City"</span>
<span style="display:block;margin-left:20%;margin-right:20%;padding-top:10px;padding-right:10px;padding-bottom:10px; font-size: 14px; color: white;border-radius:5px;"> </span>
<span style="border-radius: 5px;display:block;margin-left:20%;margin-right:20%;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px; font-size: 14px; background: #3D87F5; color: white;">Watch my film "red hook, rush hour"</span>
<span style="display:block;margin-left:20%;margin-right:20%;padding-top:10px;padding-right:10px;padding-bottom:10px; font-size: 14px; color: white;border-radius:5px;"> </span>
</td>
</tr>
<tr>
<td style="font-size: 14px; text-align: center; padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px; background: #3A8E47;">
<a href="http://www.bartonlewisfilm.com" style="display: inline-block; padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px; background: #3A8E47;
text-decoration: none; color: white;" title="visit bartonlewisfilm.com" target="_blank;">bartonlewisfilm.com</a> | home (718) 399-8344 | cell (347) 325-4415
</td>
</tr>
</table>
</body>
</html>

Change color of a span on hover with CSS

I know what is the right syntax to change the color attribute of a span but I can't reproduce this behaviour and I don't know why
This is the HTML Code:
<div class="col-lg-3 col-md-3 col-sm-6 btn">
<table class="table panelc" id="panelc">
<tbody>
<tr>
<td>
<span class="bpost-parcellocker" style="color: #EF2637; font-size: 90px; "></span>
</td>
<td class="text-center text-nowrap">
Vanaf<br>€4,00
</td>
</tr>
<tr>
<td>
Een pakjesautomaat
</td>
<td></td>
</tr>
</tbody>
</table>
</div>
CSS:
.table.panelc:hover, .table.panelc:hover span {
background-color: #EF2637;
color: white;
}
Only the content of the table will be changed but not the color for the span, why ? I did several attempts and the selector is correct.
Indeed If I try to change the background of the span everything works well
It's because inline style has higher specificity than the one in your css.
Read more about CSS specificity here: http://cssspecificity.com/
if you want to have your inline style do as follow:
.table.panelc:hover, .table.panelc:hover span {
background-color: #EF2637;
color: white !important;
}

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>
");
?>