Hover over button, strikethrough text - html

I'm trying to edit my code so, that if I hover over the delete button, the text gets a strikethrough-line, just like the css option text-decoration: line-through does.
EDIT:
I'm trying to have the Text "Creating this basic TODO Website" with a strikethrough, when hovering over the delete button
Is there a way to achieve this, without using JS, or do I need to use JS? (I'm currently using Bootstrap4)
The Code part is:
<tr>
<th scope="row">3</th>
<td class="text-justify">Creating this basic TODO Website</td>
<td>14/05/2020</td>
<td>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 10%;" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">10%</div>
</div>
</td>
<td>
<button type="button" class="btn btn-info" data-toggle="tooltip" data-placement="top" title="Edit" onclick="window.location.href='Edit.html' ;">
<i class="material-icons">create</i>
</button>
<button type="button" class="btn btn-warning">
<i class="material-icons">delete</i>
</button>
</td>
</tr>

Okay, I think I understand your problem. The problem is there is no "previous sibling" or "parent" selector in css. But I think a little bit tricky dom modification, and pure css, you can achive your goal.
table tr {
display:flex;
flex-direction: row-reverse;
}
table tr td:hover+td+td+td+td.your-text {
text-decoration: line-through;
}
<table border=1>
<tr>
<td>
<button type="button" class="btn btn-warning">
<i class="material-icons">delete</i>
</button>
</td>
<td>
<button type="button" class="btn btn-info" data-toggle="tooltip" data-placement="top" title="Edit" onclick="window.location.href='Edit.html' ;">
<i class="material-icons">create</i>
</button>
</td>
<td>
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 10%;" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">10%</div>
</div>
</td>
<td>14/05/2020</td>
<td class="text-justify your-text">Creating this basic TODO Website</td>
<th scope="row">3</th>
</tr>
</table>
Explanation: The td-s are reversed, and css flexbox make re-reverse order. So it visible as normal order, but it is important: in the dom, it is reversed. After that you can use next element selector (+) more than once times. And the last trick: I split the buttons cell into two parts to access to delete button's cell exactly.

You can do it with CSS
i:hover {
text-decoration: line-through;
}

When you use bootstrap X, you can still use CSS:
button.not-available:hover, button.not-available i:hover {
text-decoration: line-through;
}
<button class="not-available">
<i>create</i>
</button>
<button>
<i>delete</i>
</button>

Related

Putting space between 2 buttons in a td

i have a td
<td align="left">
<button class="button_tabel"><div class="button_tabel_text_hero"> hero</div> </button>
<!-- todo Put a gap here 48 px -->
<button class="button_tabel"><div class="button_tabel_text_zero"> zero </div> </button>
</td>
How can i put a gap of around 48 px in between these two buttons which lie in this td
i wish to put space separately out of buttons so that this can be changed from backbone easily without impacting other components
Put some margin on one of the buttons:
<td align="left">
<button class="button_tabel">
<div class="button_tabel_text_hero"> hero</div>
</button>
<button class="button_tabel">
<div class="button_tabel_text_zero"> zero </div>
</button>
</td>
.button_tabel:first-of-type {
margin-bottom: 48px;
}
Add margin-left:48px on .button_tabel
.button_tabel + .button_tabel{
margin-left:48px;
}
Just select the first class and add a margin:
.button_tabel:first-child{
margin-right:48px;
}
<td align="left">
<button class="button_tabel"><div class="button_tabel_text_hero"> hero</div> </button>
<!-- todo Put a gap here 48 px -->
<button class="button_tabel"><div class="button_tabel_text_zero"> zero </div> </button>
</td>

CSS - white-space:nowrap isn't preventing line break

So I am trying to put a progress bar and a button in a button in the same line but for some reason, it doesn't work
<button type="button" class="btn btn-primary text-nowrap" style="white-space:nowrap;">
cpu usage procentage: <span class="badge badge-light live text-nowrap" id ="cpu" style="white-space:nowrap;">{{computer.cpu_usage_procentage}}</span>
</button>
<div class="progress">
<div id="cpu-progress" class="progress-bar bg-danger" role="progressbar" style="width: {{computer.cpu_usage_procentage}}%" aria-valuenow="{{computer.cpu_usage_procentage}}" aria-valuemin="0" aria-valuemax="100">{{computer.cpu_usage_procentage}}</div>
</div>
What I want is them to be in the same line instead of different lines so I saw that white-space:nowrap; should do the work but for some reason, it still doesn't work
white-space relates to text wrapping. this is two elements.
add this to the css:
.progress {
display: inline-block;
}

Vertcally align text and text of float-right element

I have a very simple table and I want to vertically align the text of two elements, one of which is plain text and the other is a button (I've put them in span tags, because I've been trying different things), so now the code snippet looks like that:
<tr>
<td>element</td>
<td>
<span> test </span>
<span>
<button class="btn btn-danger pull-right">Delete</button>
</span>
</td>
</tr>
and
th, tr, td{
vertical-align: middle !important;
}
Unfortunately no matter what I try, as long as I use the pull-right class it looks like this:
The "test" element just won't align in the middle or align with the "Delete" text of the button. Any tips would be appreciated!
remove pull-right class and try this instead :
<tr>
<td>element</td>
<td class="d-flex align-items-center justify-content-between">
<span> test </span>
<span>
<button class="btn btn-danger">Delete</button>
</span>
</td>
</tr>
try this:
span.test{
line-height: 35px;
}
th, td {
border: 1px solid black;
}
<tr>
<td>element</td>
<td>
<span class="float-left test"> test </span>
<span class="float-right">
<button class="btn btn-danger pull-right">Delete</button>
</span>
</td>
</tr>

twitter bootstrap html tool-tip oddness

I'm trying to add html tool-tips to an existing page that's made of a table on one side of the page and something else on the other. I want to add the tool-tip to each td in the table.
With the tool-tip added to each td every time I hover over a td the whole table shifts over one cell!
Also, tried only on chrome.
before the hover
And when I hover over the first td
Below is a cut down, but fully working example of the oddness, any thoughts appreciated.
<!DOCTYPE html>
<html>
<head lang="en">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="shortcut icon" href="static/img/favicon.ico" type="image/x-icon" />
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<div class="table-responsive" id="23">
<TABLE class="table table-bordered table-nonfluid">
<tr id="hdr" class="bg-primary h5">
<th class="text-center">Mon 18 May</th>
<th class="text-center">Thu 21 May</th>
</tr>
<tr id="day" class="text-center">
<td class="bg-danger"
data-trigger="hover"
data-placement="auto"
data-html="true"
data-title="<div>WHAT!</div>"
data-toggle="tooltip"
>
<sup>300</sup>/<sub>312</sub>
</td>
<td class="bg-danger"
data-trigger="hover"
data-placement="auto"
data-html="true"
data-title="<div>WHAT!</div>"
data-toggle="tooltip"
>
<sup>277</sup>/<sub>312</sub></td>
</tr>
</TABLE>
</div>
</div>
<div class="col-md-6 " style="padding-top: 16px;">
<blockquote id="comment_txt">before, after and then on</blockquote>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script>
$( document ).ready(function() {
$('[data-toggle="tooltip"]').tooltip()
});
</script>
</body>
</html>
I suggest to wrap the content of your td inside a span like this
<td><span data-trigger="hover" style="display:block"
data-placement="auto"
data-html="true"
data-title="<div>WHAT!</div>"
data-toggle="tooltip"><sup>300</sup>/<sub>312</sub></span></td>
Is never a good idea using the tooltips directly on a table element.
Well this is a weird issue actually. Never realised it until now. This might not be the perfect fix but a temporary fix will be to place a span around the text in the td for the one on the left and for the td on the right leave it as it is right now because it works fine only the left one causes this issue.
Bootply Link right here
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<div class="table-responsive" id="23">
<TABLE class="table table-bordered table-nonfluid">
<tr id="hdr" class="bg-primary h5">
<th class="text-center">Mon 18 May</th>
<th class="text-center">Thu 21 May</th>
</tr>
<tr id="day" class="text-center">
<td class="bg-danger" >
<span data-trigger="hover"
data-placement="auto"
data-html="true"
data-title="WHAT!"
data-toggle="tooltip">
<sup>300</sup>/<sub>312</sub>
</span>
</td>
<td class="bg-danger"
data-trigger="hover"
data-placement="auto"
data-html="true"
data-title="<div>WHAT!</div>"
data-toggle="tooltip"
>
<sup>277</sup>/<sub>312</sub></td>
</tr>
<tr id="day" class="text-center">
<td class="bg-danger" >
<span data-trigger="hover"
data-placement="auto"
data-html="true"
data-title="WHAT!"
data-toggle="tooltip">
<sup>300</sup>/<sub>312</sub>
</span>
</td>
<td class="bg-danger"
data-trigger="hover"
data-placement="auto"
data-html="true"
data-title="<div>WHAT!</div>"
data-toggle="tooltip"
>
<sup>277</sup>/<sub>312</sub></td>
</tr>
</TABLE>
</div>
</div>
<div class="col-md-6 " style="padding-top: 16px;">
<blockquote id="comment_txt">before, after and then on</blockquote>
</div>
</div>
</div>
The problem with my fix is simple. The tooltip will only show on the left td if you hover on the text in the cell not on the table-cell itself whilst the tooltip will show if you hover on the table cell on the right. bad for user experience I know but this is as i said a temporary fix.

Bootstrap 2.3.2 split button dropdowns in tables line

The dropdown on the right is in a table cell, this works as intended on desktop browser.
However on mobile, on click, the dropdown gets split into two lines:
HTML
<table class="table table-striped table-bordered table-hover">
<tr>
<td> ... </td>
<td> ... </td>
<td> ... </td>
<td>
<div class="btn-group">
<i class="icon-eye-open icon-white"></i> Visualizza
<button class="btn dropdown-toggle btn-primary btn-small" data-toggle="dropdown"><span class="caret"></span></button>
<ul class="dropdown-menu">
<li><i class="icon-pencil"></i> Modifica</li>
<li><a class="btn-confirm" href="#"><i class="icon-trash"></i> Elimina</a></li>
</ul>
</div>
</td>
</tr>
</table>
The problem most likely stems from the table cell width being laid out too short for both elements.
The simplest solution would be to set add a class to that cell and add min-width, though you would be moving away from pure bootstrap.
HTML:
<td> ... </td>
<td class="dropdownCell">
<div class="btn-group">
...
Css:
.dropdownCell { min-width:130px; }
Fiddle is here: http://jsfiddle.net/a4kx75t1/1/