How to create a custom tooltip on <tr> using HTML+CSS - html

I have a custom table and what I would like to have is some text box appearing after you hover over its row. Some of the rows will be blurred, so I will add this in the example code as well. The issue that I'm facing is that I am clearly not good at CSS or HTML and I can't quite figure out how to adress the table row for that to work correctly and I have not found any solutions for that. I have successfully added the same tooltip to the column names, so you will se what I want to achieve in the example below:
<style>
* {
box-sizing: border-box;
}
.tooltip {
font-size: 15px;
position: relative;
display: inline-block;
}
.tooltip .tooltiptext {
visibility: hidden;
max-width: 60vw;
background-color: white;
border-style: solid;
border-color: #1a7bc9;
color: #000;
text-align: left;
border-radius: 6px;
padding: 15px 15px;
position: absolute;
z-index: 100;
bottom: 100%;
left: 50%;
margin-left: 0%;
/* I think this ↑ is supposed to help with it skewing to the right
but it does not... */
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
.styled-table:hover .tooltiptext {
visibility: visible;
}
.styled-table th,
.styled-table td {
padding: 12px 15px;
}
.styled-table tbody tr:nth-of-type(even):hover,
.styled-table tr:hover {
background-color: #c7c7c7;
}
.styled-table {
border-collapse: collapse;
margin: 25px 0;
font-size: 0.9em;
font-family: sans-serif;
min-width: 400px;
max-width: 57vw;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
position: relative;
margin-left: 15vw;
cursor: pointer;
}
.styled-table tbody tr:nth-of-type(even) {
background-color: #f3f3f3;
}
.styled-table tbody tr.active-row {
font-weight: bold;
}
</style>
<div class='tooltip'>&ltTooltip&gt
<span class="tooltiptext">this is just a minimal tooltip</span>
</div>
<table>
<thead>
<tr>
<th id="C1">Column_1
</th>
<th id="C2">
<div class="tooltip">Column_2
<span class="tooltiptext">This is my favourite column, it's so epic ngl</span>
</div></th>
<th id="C3" >
<div class="tooltip">Column_3
<span class="tooltiptext">This one is also good, but I like column 2 a little more</span>
</div>
</th>
<tr class="styled-table" style="text-color: #1a7bc9
filter: blur(4px) -o-filter:blur(4px)
-ms-filter:blur(4px);
-moz-filter:blur(4px);
-webkit-filter: blur(4px);
"> <!-- For some reson blur ignores text-color -->
<span class="tooltiptext">This is not supposed to be visible</span>
<td>Wow, hidden</td>
<td>Shhhh</td>
<td>Epic</td>
</tr>
</table>
Here you can see that I have a table row of class styled-table and inside of it there is a class tooltiptext. I am trying to adress it using .styled-table:hover .tooltiptext, but nothing happens. Also, the tooltip appears to be skewed to the right and blur removes the text color, but this is not the main concern :)

Related

Nested div doesn't overlap parent's siblings

I have a very convoluted table in which I have to add a menu that appears on hover and has its position based on each row's position.
Every row is generated at the same time in a loop (React props.map), so changing the next row z-index is possible, but I don't know if I should.
I managed to do some work, but I can't seem to make the menu appear on top of the "th" other than its parent.
I know it (probably) has to do with the Stacking Context, but I don't know how to fix this.
This fiddle represents a very resumed version of the table: https://jsfiddle.net/4n9bj16x/2/
I tried a lot of things, and some worked but then it broke something else. What I need is a way of maintaining the first column fixed and make this menu overlap all "th" siblings.
Things that worked but broke something else:
Taking the "sticky" position out of the "th", the menu will overlap perfectly, but then it break the fixed first column.
Make the menu relative positioned, then it enters the normal flow, but that makes the div grow in and out.
Remove the "th" background-color property, but then it becomes invisible and, when the table is scrolled, you can see all the other columns underneath.
Thanks in advance!
PS: The original table is coded in React and SCSS, if this is of any help.
HTML & CSS: (the fiddle is written in scss because its easier to read)
.overflowTable {
overflow-x: scroll;
margin-left: 0;
overflow-y: visible;
padding: 0;
position: relative;
height: 100vh;
}
table {
border-collapse: separate;
}
tr {
background-color: white;
}
th {
border-right: 2px solid #eee;
font-weight: 600;
color: #333;
left: 0;
position: sticky;
z-index: 2;
background-color: inherit;
}
tbody tr:hover {
background-color: #fafafa;
}
tbody th {
cursor: pointer;
}
tbody td {
cursor: grab;
}
tbody td:active {
cursor: grabbing;
}
.headerTable {
font-family: "Open-sans", sans-serif;
font-style: normal;
font-weight: 600;
font-size: 18px;
line-height: 25px;
color: #666;
border-bottom: 2px solid #eee;
padding: 10px 30px;
min-width: 150px;
}
.content {
padding: 10px 30px;
}
.content .actualMenu {
visibility: hidden;
}
.content .menuMore {
position: absolute;
width: 250px;
visibility: hidden;
right: 0;
background-color: #333;
color: white;
box-shadow: 0 4px 2px rgba(0, 0, 0, 0.1), 4px 4px 10px rgba(0, 0, 0, 0.1);
}
.content:hover .actualMenu, .content:hover .menuMore {
visibility: visible;
}
.content .title {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.content .title .name {
flex: 1;
}
.content .title .moreOptions {
position: relative;
flex: 0;
}
<div class="overflowTable">
<table>
<thead>
<tr>
<th class="headerTable">
Name
</th>
<td class="headerTable">
Status
</td>
<td class="headerTable">
People
</td>
<td class="headerTable">
Date
</td>
</tr>
</thead>
<tbody>
<tr>
<th class="content">
<div class="title">
<div class="name">
Name
</div>
<div class="moreOptions">
<span class="actualMenu">...</span>
<div class="menuMore"> Options<br/>
Options<br/>
Options<br/>
Options<br/>
Options<br/>
</div>
</div>
</div>
</th>
<td class="content">
Status
</td>
<td class="content">
First Person
</td>
<td class="content">
Random Date
</td>
</tr><tr>
<th class="content">
<div class="title">
<div class="name">
Name
</div>
<div class="moreOptions">
<span class="actualMenu">...</span>
<div class="menuMore"> Options<br/>
Options<br/>
Options<br/>
Options<br/>
</div>
</div>
</div>
</th>
<td class="content">
Status
</td>
<td class="content">
First Person
</td>
<td class="content">
Random Date
</td>
</tr>
</tbody>
</table>
</div>
FIRST ANSWER:
You have to remove background-color: inherit; from th.
w3schools resource:
The inherit keyword specifies that a property should inherit its value from its parent element.
UPDATE:
First of all, sorry for misunderstanding,
You gave z-index: 2; to .content class. Its mean all .content elements have equal index. You can fix this and add another way. Go second row and add z-index: 3; then you will understand me. :)
here is fiddle
<th class="content" style="z-index: 3!important;">
Sorry for my bad english.
On hover change tr's and th's z-index
.overflowTable {
overflow-x: scroll;
margin-left: 0;
overflow-y: visible;
padding: 0;
position: relative;
height: 100vh;
}
table {
border-collapse: separate;
}
tr {
background-color: white;
position: relative;
z-index: 1;
}
tr:hover {
z-index: 2;
}
tr:hover th {
z-index: 3;
}
th {
border-right: 2px solid #eee;
font-weight: 600;
color: #333;
left: 0;
position: sticky;
z-index: 2;
background-color: inherit;
}
tbody tr:hover {
background-color: #fafafa;
}
tbody th {
cursor: pointer;
}
tbody td {
cursor: grab;
}
tbody td:active {
cursor: grabbing;
}
.headerTable {
font-family: "Open-sans", sans-serif;
font-style: normal;
font-weight: 600;
font-size: 18px;
line-height: 25px;
color: #666;
border-bottom: 2px solid #eee;
padding: 10px 30px;
min-width: 150px;
}
.content {
padding: 10px 30px;
}
.content .actualMenu {
visibility: hidden;
}
.content .menuMore {
position: absolute;
width: 250px;
visibility: hidden;
right: 0;
background-color: #333;
color: white;
box-shadow: 0 4px 2px rgba(0, 0, 0, 0.1), 4px 4px 10px rgba(0, 0, 0, 0.1);
}
.content:hover .actualMenu, .content:hover .menuMore {
visibility: visible;
}
.content .title {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.content .title .name {
flex: 1;
}
.content .title .moreOptions {
position: relative;
flex: 0;
}
<div class="overflowTable">
<table>
<thead>
<tr>
<th class="headerTable">
Name
</th>
<td class="headerTable">
Status
</td>
<td class="headerTable">
People
</td>
<td class="headerTable">
Date
</td>
</tr>
</thead>
<tbody>
<tr>
<th class="content">
<div class="title">
<div class="name">
Name
</div>
<div class="moreOptions">
<span class="actualMenu">...</span>
<div class="menuMore"> Options<br/>
Options<br/>
Options<br/>
Options<br/>
Options<br/>
</div>
</div>
</div>
</th>
<td class="content">
Status
</td>
<td class="content">
First Person
</td>
<td class="content">
Random Date
</td>
</tr><tr>
<th class="content">
<div class="title">
<div class="name">
Name
</div>
<div class="moreOptions">
<span class="actualMenu">...</span>
<div class="menuMore"> Options<br/>
Options<br/>
Options<br/>
Options<br/>
</div>
</div>
</div>
</th>
<td class="content">
Status
</td>
<td class="content">
First Person
</td>
<td class="content">
Random Date
</td>
</tr>
</tbody>
</table>
</div>

Freeze the first two rows on vertical scrolling of the page

I have implemented a table with horizontal scrolling in angular and have requirement to fix the first two columns while scrolling vertically. I have created a stackblitz to show two tables. What I looking for is that as and when the user scrolls the second table, the first two rows that is Legal Class Name and Fund Name should be fixed.
I tried to apply the following class to the respective tds and it didnt work
.stickyRows {
position: sticky;
}
Here is the stackblitz
https://stackblitz.com/edit/angular-o2ukfs
th {
padding: 7px;
position: sticky;
left: 0px;
min-width: 250px;
width: 250px;
background-color: #f5f7f7;
}
td {
padding: 7px;
min-width: 250px;
/* max-width: 300px; */
}
.fundClassesTable {
table-layout: fixed;
}
.cellbgcolor {
color: transparent;
}
.btn {}
.tableItem {
text-align: left;
border-left: solid 1px lightgrey;
border-top: solid 1px lightgrey;
border-right: solid 1px lightgrey;
border-bottom: solid 1px lightgrey;
}
.rowItem:hover {
background-color: #f5f7f7;
}
label {
margin-left: 0.5rem;
vertical-align: middle
}
.panel-heading {
color: black;
border-color: #ddd;
overflow: hidden;
padding-top: 5px !important;
padding-bottom: 5px !important;
}
.panel-heading .left-label {
display: inline-block;
padding-top: 5px !important;
}
.scrollClass {
overflow-x: scroll;
display: grid;
overflow-y:hidden;
height: 100%;
}
.panel-heading label {
margin-bottom: 0px !important;
}
#FundClass tr:hover {
background-color: #ECF0F1;
}
.headcol {
position: absolute;
min-width: 300px;
max-width: 300px;
width: 5em;
left: 0;
top: auto;
border-top-width: 1px;
/*only relevant for first row*/
margin-top: -1px;
/*compensate for top border*/
}
.headcol:before {
content: 'Row ';
}
.collapsed {
color: #d6630a;
font-size: 22px;
text-decoration: none;
font-weight: bold;
}
.expanded {
color: #d6630a;
font-size: 22px;
text-decoration: none;
font-weight: bold;
}
.fixed-side {
border: 1px solid #000;
background: #eee;
visibility: visible;
}
.card-body {
flex: 1 1 auto;
padding: 0px;
margin: 10px 0;
background-color: white;
}
<div class="card">
<div class="card-header panel-heading">
<span class="left-label" style="font-size: 18px; font-weight: bold; ">Accounting Fund Classes</span>
</div>
<div [ngClass]="{'show': isExpanded}" id="fundClass" class="collapse" role="tabpanel" aria-labelledby="fundClass_heading"
data-parent="#fundClass" [attr.aria-expanded]="isExpanded">
<div class="card-body scrollClass" *ngIf="data">
<table id="FundClass" class="fundClassesTable table-striped">
<tr *ngFor="let c of ColumnNames">
<th Fund Name scope="col" [ngClass]="c != 'Buttons1'? 'tableItem bold' : 'tableItem cellbgcolor'"> {{ c }}</th>
<ng-container *ngFor="let f of data let i=index">
<td class="tableItem" style="font-weight: bold" *ngIf="c == 'Fund Name'">
{{ f.FundName}}
</td>
<td [attr.id]="'f.Id'" *ngIf="c == 'Accounting Class Name'"
class="tableItem">
{{ f.FundName}}
</td>
<td class="tableItem" *ngIf="c == 'Class ID'">{{f.Id}}</td>
<td [attr.id]="'f.Id'" *ngIf="c == 'Legal Fund Class'"
class="tableItem">
{{ f.LegalFundClassName}}
</td>
<td [attr.id]="'f.Id'" *ngIf="c == 'Invested Amount'"
class="tableItem">
{{ f.InvestedAmount | number : '.2-2'}}
</td>
<td [attr.id]="'f.Id'" *ngIf="c == 'Vehicle Type'"
class="tableItem">
{{ f.VehicleTypeName}}
</td>
<td [attr.id]="'f.Id'" *ngIf="c == 'Closure Status'"
class="tableItem">
{{ f.ClosureStatusName}}
</td>
<td class="tableItem" *ngIf="c == 'Buttons1'">
<button *ngIf="!EditMode[f.Id]" type="button"
class="btn btn-primary btn mr-1 "
(click)="buttonClicked(f.Id)">Edit</button>
<button *ngIf="EditMode[f.Id]" type="button"
class="btn btn-primary btn mr-1"
(click)="buttonClicked(f.Id)">Cancel</button>
</td>
</ng-container>
</tr>
</table>
</div>
</div>
</div>
I hope this is what you were looking for:
app.component.css
/* Container should define how tall the scrollable content is */
.scrollClass{
height: 500px;
}
/* tagetting the first <th>; to ensure <th> are scrolled along with <td> */
.fundClassesTable tr:nth-child(1) th{
z-index: 3;
position: sticky;
position: -webkit-sticky;
top: 2px;
}
/* target all <td> in the first row to be sticky */
.fundClassesTable tr:nth-child(1) td{
color: red;
position: sticky;
position: -webkit-sticky;
top: 2px;
z-index: 2;
background-color: white;
font-weight: bold;
}
/* Same as above but with top property as 36px
because the 2nd "row" is 36px from the top of <table> */
.fundClassesTable tr:nth-child(2) th{
z-index: 3;
position: sticky;
position: -webkit-sticky;
top: 38px;
}
.fundClassesTable tr:nth-child(2) td{
color: red;
position: sticky;
position: -webkit-sticky;
top: 38px;
z-index: 2;
background-color: white;
font-weight: bold;
}
Forked Stackblitz
EDIT:
Riv's solution has worked for me but i am left with one nagging problem. As I scroll through the fixed rows , I can see the data of the rows visible between gaps of the fixed rows and border of the fixed rows arent visible
Probably not the best solution out there but I would use ::after pseudo selector to create a background for your stickied table cells to hide the background cells when scrolling down.
.fundClassesTable tr:nth-child(1)::after{
content: '';
position: absolute;
height: 71px;
width: 96.7%;
top: 55px;
left: 19px;
z-index: 1;
background-color: white; //create a white background to cover your other cells when scrolled down
border: solid 1px deeppink;
}
try adding this to your styling
.card-body{
height:200px;
position:relative!important;
overflow-y:scroll;
}
table tr:nth-child(1){
position :sticky;
top:0;
z-index:999;
left:0;
background-color:#fff;
}
table tr:nth-child(2){
position :sticky;
top:35px;
z-index:999;
background-color:#fff;
left:0;
}

How to style file input?

Ok so I got the following:
What I want to do is to make the button which says "Elegir archivos" to be orange like the button that says "Finalizar" and make the text the file-input produces grey like the text which says "Formatos aceptados".
Here's what I tried:
<tr>
<td class="upload-pic"><input class="file-submit" type="file" name="fileUpload" size="50" multiple="multiple"/></td>
</tr>
CSS:
.file-submit {
height: 35px !important;
width: 300px !important;
padding: 5px !important;
font-size: 15px !important;
margin-right: 10px !important;
margin-top: 10px !important;
margin-bottom: 20px !important;
background-color:red;
}
input[type="file"] {
width: 80%;
color: white;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
background-color: #FD8907;
margin-left: 10px;
float: right;
}
What I want: The button which says "Elegir archivos" has to be orange with its text in white. The text next to it which says "No se eligio archivo" has to be grey with the white background. For some reason everything ends up in a big orange box and the button still looks like the default one.
In order to achieve that, you can wrap the input button with "label", so that label becomes clickable. Then make your input button opacity 0 (transparent).
$('.file-submit').on('change', function(){
$(this).closest('.btn-wrapper').find('span')
.text('FOTOS Formatos aceptados: JPG');
})
.btn-wrapper {
font-family: 'Veranda', sans-serif;
}
.btn-file {
padding: 8px 15px;
background-color: #fd8907;
border-radius: 3px;
color: #fff;
margin-right: 8px;
}
.btn-file input[type=file] {
position: absolute;
top: 0;
right: 0;
min-width: 100%;
min-height: 100%;
font-size: 100px;
text-align: right;
filter: alpha(opacity=0);
opacity: 0;
outline: none;
background: white;
cursor: inherit;
display: block;
}
.btn-file span {
display: block;
color: #777;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<td>
<div class="btn-wrapper">
<label class="btn-file">
Elegir archivos
<input type="file" class="file-submit" name="fileUpload" accept=".jpg" multiple="multiple">
</label>
<span>No se eligio archivo</span>
</div>
</td>
But if you want to change the text after file is selected, you will need some help with javascript or jQuery.
Basically what the problem is, that the browser doesn't know that you want it to be orange. Because your file says that it is a button, it is applying the default HTML button style to it. To clear this, in the CSS, all you have to say is:
tr td input.file-submit {
text-decoration: none;
color: #ffffff;
}
Then, just change the color of the text to #848D95.
There you go. Done.
Hope this helps!!!

How to make span wrap words without defining a width or max-width on the container div?

I have the following partially generated generated and simplified code which is used to display warnings or errors in Dojo dialogs:
/*Relevant CSS:*/
.l-status-message-wrapper {
height: auto;
margin-left: 5px;
margin-top: 2px;
min-height: 15px;
}
.l-status-message-wrapper--dialog {
margin-left: 0px;
display: block;
word-wrap: break-word;
}
.c-global-message {
min-height: 15px;
color: #a5cf42;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
}
.c-global-message--error {
color: #e31d25;
}
.dijitDialog {
background: #eee;
border: 1px solid #d3d3d3;
-webkit-box-shadow: 0 5px 10px #adadad;
padding: 0;
}
.dijitDialog {
position: absolute;
z-index: 999;
overflow: hidden;
}
.dijitDialogTitleBar {
background: #C9CFD2 url(../../images/onglet_bg.gif) repeat-x;
vertical-align: middle;
}
.dijitDialogTitleBar {
background: #fafafa url(images/titleBar.png) repeat-x top left;
padding: 5px 6px 3px 6px;
outline: 0;
}
.dijitDialogTitleBar {
cursor: move;
}
form {
width: 200px;
height: 200px;
background-color: green;
}
<div class="dijitDialog dijitDialogFocused dijitFocused" role="dialog" aria-labelledby="machineParameterDialog_title" id="machineParameterDialog" widgetid="machineParameterDialog">
<div data-dojo-attach-point="titleBar" class="dijitDialogTitleBar">
<span data-dojo-attach-point="titleNode" class="dijitDialogTitle" id="machineParameterDialog_title" role="heading" level="1">Edit Machine Parameter</span>
<span data-dojo-attach-point="closeButtonNode" class="dijitDialogCloseIcon" data-dojo-attach-event="ondijitclick: onCancel" title="Cancel" role="button" tabindex="0">
<span data-dojo-attach-point="closeText" class="closeText" title="Cancel">x</span>
</span>
</div>
<div data-dojo-attach-point="containerNode" class="dijitDialogPaneContent" style="width: auto; height: auto;">
<div id="machineParameterDialogContents" class="machineParameterDialogContents">
<span class="l-status-message-wrapper l-status-message-wrapper--dialog">
<span id="machineParameterDialogStatus" class="c-global-message c-global-message--error">
error: <span>Action not successful. Please correct the validation errors</span>
</span>
</span>
<form id="machineParameterDialogForm" name="machineParameterDialogForm" action="/machineParameterAction.action" method="POST" class="c-panel-dialog">
</form>
</div>
</div>
</div>
I'd like long text in .l-status-message-wrapper--dialog to not increase the width of the .machineParameterDialogContents div.
However, I'd rather not give the .machineParameterDialogContents div or any of the parent divs a width or max-width. I want the container to adjust the width based on the widest element AFTER the component with long text, which can vary on a page by page basis and sometimes even be different on the same page for the same dialog depending on what action is being performed. To clarify: It's the outside .machineParameterDialogContents div I don't want to widen, not the .l-status-message-wrapper--dialog span. That span should widen to at most the size of any other components in the page. Also, everything inside the machineParameterDialogContents div is loaded through Ajax, in case it's relevant.
So in the above example, I don't want the span to be more than 200px, and the rest should automatically wrap, but I want this without defining a max-width on the span or the machineParameterDialogContents div. Note that I have given the form a fixed width, but in reality this width can change between dialog loads and is pretty dynamic.
Is this at all possible? I need to support Chrome, Firefox and IE11.
The simplest add to what you already had is to just add
max-width: fit-content to .l-status-message-wrapper--dialog
and it makes the text fit the available width and doesn't add to the overall width
/*Relevant CSS:*/
.l-status-message-wrapper {
height: auto;
margin-left: 5px;
margin-top: 2px;
min-height: 15px;
}
.l-status-message-wrapper--dialog {
margin-left: 0px;
display: block;
max-width: fit-content;
}
.c-global-message {
min-height: 15px;
color: #a5cf42;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
}
.c-global-message--error {
color: #e31d25;
}
.dijitDialog {
background: #eee;
border: 1px solid #d3d3d3;
-webkit-box-shadow: 0 5px 10px #adadad;
padding: 0;
}
.dijitDialog {
position: absolute;
z-index: 999;
overflow: hidden;
}
.dijitDialogTitleBar {
background: #C9CFD2 url(../../images/onglet_bg.gif) repeat-x;
vertical-align: middle;
}
.dijitDialogTitleBar {
background: #fafafa url(images/titleBar.png) repeat-x top left;
padding: 5px 6px 3px 6px;
outline: 0;
}
.dijitDialogTitleBar {
cursor: move;
}
form {
width: 200px;
height: 200px;
background-color: green;
}
<div class="dijitDialog dijitDialogFocused dijitFocused" role="dialog" aria-labelledby="machineParameterDialog_title" id="machineParameterDialog" widgetid="machineParameterDialog">
<div data-dojo-attach-point="titleBar" class="dijitDialogTitleBar">
<span data-dojo-attach-point="titleNode" class="dijitDialogTitle" id="machineParameterDialog_title" role="heading" level="1">Edit Machine Parameter</span>
<span data-dojo-attach-point="closeButtonNode" class="dijitDialogCloseIcon" data-dojo-attach-event="ondijitclick: onCancel" title="Cancel" role="button" tabindex="0">
<span data-dojo-attach-point="closeText" class="closeText" title="Cancel">x</span>
</span>
</div>
<div data-dojo-attach-point="containerNode" class="dijitDialogPaneContent" style="width: auto; height: auto;">
<div id="machineParameterDialogContents" class="machineParameterDialogContents">
<span class="l-status-message-wrapper l-status-message-wrapper--dialog">
<span id="machineParameterDialogStatus" class="c-global-message c-global-message--error">
error: <span>Action not successful. Please correct the validation errors</span>
</span>
</span>
<form id="machineParameterDialogForm" name="machineParameterDialogForm" action="/machineParameterAction.action" method="POST" class="c-panel-dialog">
</form>
</div>
</div>
</div>
You can use flex and add another div on the right. Then set flex-grow: 1 for both. If the right div have more content it will take the rest of the screen, if not, the left div will stretch. I think it's the best you can do without defining any width.
/*Relevant CSS:*/
.l-status-message-wrapper {
height: auto;
margin-left: 5px;
margin-top: 2px;
min-height: 15px;
}
.l-status-message-wrapper--dialog {
margin-left: 0px;
display: block;
word-wrap: break-word;
}
.c-global-message {
min-height: 15px;
color: #a5cf42;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
}
.c-global-message--error {
color: #e31d25;
}
.dijitDialog {
background: #eee;
border: 1px solid #d3d3d3;
-webkit-box-shadow: 0 5px 10px #adadad;
padding: 0;
}
.dijitDialog {
position: absolute;
z-index: 999;
overflow: hidden;
}
.dijitDialogTitleBar {
background: #C9CFD2 url(../../images/onglet_bg.gif) repeat-x;
vertical-align: middle;
}
.dijitDialogTitleBar {
background: #fafafa url(images/titleBar.png) repeat-x top left;
padding: 5px 6px 3px 6px;
outline: 0;
}
.dijitDialogTitleBar {
cursor: move;
}
form {
width: 200px;
height: 200px;
background-color: green;
}
.dijitDialogPaneContent{
display: flex;
}
.machineParameterDialogContents{
flex-grow: 1;
}
.more-content{
flex-grow: 1;
}
<div class="dijitDialog dijitDialogFocused dijitFocused" role="dialog" aria-labelledby="machineParameterDialog_title" id="machineParameterDialog" widgetid="machineParameterDialog">
<div data-dojo-attach-point="titleBar" class="dijitDialogTitleBar">
<span data-dojo-attach-point="titleNode" class="dijitDialogTitle" id="machineParameterDialog_title" role="heading" level="1">Edit Machine Parameter</span>
<span data-dojo-attach-point="closeButtonNode" class="dijitDialogCloseIcon" data-dojo-attach-event="ondijitclick: onCancel" title="Cancel" role="button" tabindex="0">
<span data-dojo-attach-point="closeText" class="closeText" title="Cancel">x</span>
</span>
</div>
<div data-dojo-attach-point="containerNode" class="dijitDialogPaneContent" style="width: auto; height: auto;">
<div id="machineParameterDialogContents" class="machineParameterDialogContents">
<span class="l-status-message-wrapper l-status-message-wrapper--dialog">
<span id="machineParameterDialogStatus" class="c-global-message c-global-message--error">
error: <span>Action not successful. Please correct the validation errors</span>
</span>
</span>
<form id="machineParameterDialogForm" name="machineParameterDialogForm" action="/machineParameterAction.action" method="POST" class="c-panel-dialog">
</form>
</div>
<div class="more-content">
“Such a little helpless creature will only be in the way,” I said; “you had better pass him up to the Indian boys on the wharf, to be taken home to play with the children. This trip is not likely to be good for toy-dogs. The poor silly thing will be in rain and snow for weeks or months, and will require care like a baby.” But his master assured me that he would be no trouble at all; that he was a perfect wonder of a dog, could endure cold and hunger like a bear, swim like a seal, and was wondrous wise and cunning, etc., making out a list of virtues to show he might be the most interesting member of the party.
</div>
</div>
</div>
After some investigating, our webdesigner has found a solution involving putting a flexbox around the span. I'm sharing the solution below for anyone else with this problem.
/*Relevant CSS:*/
.l-status-message-wrapper {
height: auto;
margin-left: 5px;
margin-top: 2px;
min-height: 15px;
}
.l-status-message-wrapper--dialog {
margin-left: 0px;
display: block;
word-wrap: break-word;
}
.c-global-message {
min-height: 15px;
color: #a5cf42;
font-size: 11px;
font-weight: bold;
text-transform: uppercase;
}
.c-global-message--error {
color: #e31d25;
}
.dijitDialog {
background: #eee;
border: 1px solid #d3d3d3;
-webkit-box-shadow: 0 5px 10px #adadad;
padding: 0;
}
.dijitDialog {
position: absolute;
z-index: 999;
overflow: hidden;
}
.dijitDialogTitleBar {
background: #C9CFD2 url(../../images/onglet_bg.gif) repeat-x;
vertical-align: middle;
}
.dijitDialogTitleBar {
background: #fafafa url(images/titleBar.png) repeat-x top left;
padding: 5px 6px 3px 6px;
outline: 0;
}
.dijitDialogTitleBar {
cursor: move;
}
form {
width: 200px;
height: 200px;
background-color: green;
}
/* Limits the width of an element so it does not exceed the width of the largest element
* on the same DOM level. It will adjust the width of its contents in cases where the parent
* element has no width value set. (e.g. A dialog message span that may not exceed the width of a accompagnied c-panel-dialog)
*
* Always use in a hierarchical markup combination (l-dynamic-width-wrapper > l-dynamic-width-wrapper-items)
*/
.l-dynamic-width-wrapper {
display: flex;
}
.l-dynamic-width-wrapper > .l-dynamic-width-wrapper-items {
flex-grow: 1;
width: 0;
}
<div class="dijitDialog dijitDialogFocused dijitFocused" role="dialog" aria-labelledby="machineParameterDialog_title" id="machineParameterDialog" widgetid="machineParameterDialog">
<div data-dojo-attach-point="titleBar" class="dijitDialogTitleBar">
<span data-dojo-attach-point="titleNode" class="dijitDialogTitle" id="machineParameterDialog_title" role="heading" level="1">Edit Machine Parameter</span>
<span data-dojo-attach-point="closeButtonNode" class="dijitDialogCloseIcon" data-dojo-attach-event="ondijitclick: onCancel" title="Cancel" role="button" tabindex="0">
<span data-dojo-attach-point="closeText" class="closeText" title="Cancel">x</span>
</span>
</div>
<div data-dojo-attach-point="containerNode" class="dijitDialogPaneContent" style="width: auto; height: auto;">
<div id="machineParameterDialogContents" class="machineParameterDialogContents">
<div class="l-dynamic-width-wrapper">
<div class="l-dynamic-width-wrapper-items">
<span class="l-status-message-wrapper l-status-message-wrapper--dialog">
<span id="machineParameterDialogStatus" class="c-global-message c-global-message--error">
error: <span>Action not successful. Please correct the validation errors</span>
</span>
</span>
</div>
</div>
<form id="machineParameterDialogForm" name="machineParameterDialogForm" action="/machineParameterAction.action" method="POST" class="c-panel-dialog">
</form>
</div>
</div>
</div>

Highlight a row on Click not working. CSS precedence

Here's the table in my html file. I have to highlight a row on click.
<tbody>
<!--display none-->
<!--onclick-->
<tr ng-repeat="case in lastten" ng-click="setSelected(case.Name)" ng-class="{selected: case.Name === idSelected}">
<td colspan="1">{{case.Name}}</td>
<td colspan="1">{{case.total}}</td>
<td colspan="1">{{case.passed}}</td>
<td colspan="1">{{case.failed}}</td>
</tr>
</tbody>
css- initialTable is the class for the above table
table.InitialTable {
table-layout: fixed;
width: 100%;
font-family: Helvetica, Arial, sans-serif;
margin-top: 20px;
margin-bottom: 20px;
border-collapse: collapse;
border-spacing: 0;
}
table.InitialTable td,
th {
border: 1px solid transparent;
height: 40px;
transition: all 0.3s;
overflow: hidden;
}
table.InitialTable th {
font-weight: bold;
text-align: center;
vertical-align: middle;
}
table.InitialTable td {
text-align: center;
vertical-align: middle;
}
table.InitialTable tr:nth-child(even) {
background: #f3f7fb;
}
table.InitialTable tr:nth-child(odd) {
background: #ffffff;
}
.InitialTable tr:hover td {
background: #eee;
}
.selected {
background: red;
}
Here's the angular code-
$scope.idSelected = null;
$scope.setSelected = function(idSelected) {
$scope.idSelected = idSelected;
};
So basically whenever a row is selected it gets the class selected and it should be highlighted. But the css is not working. So is the precedence of .selected below the hover ? I also tried a lot of other combinations , but it didn't work. Even important isn't working . I've been stuck at this for quite a while now .