I read trough a lot of the posts here but those solutions don't seem to work for me.
I have a problem with the row because it should fit the image without those white spacings ont top:
#popuptable table, th, td, tr
table.popuptable {
border-width: 1px;
border-spacing: 2px;
border-style: outset;
border-color: #2778AF !important;
border-collapse: collapse;
background-color: white;
}
table.popuptable th {
margin-left: 20px !important;
border-width: 0px;
padding: 2px;
border-style: ;
border-color: #2778AF !important;
background-color: white;
-moz-border-radius: ;
}
table.popuptable td {
border-width: 0px;
padding: 2px;
border-style: ;
border-color: #2778AF !important;
background-color: white;
-moz-border-radius: ;
}
table.popuptable tr {
border-width: 0px;
padding: 2px;
border-style: ;
border-color: #2778AF !important;
background-color: white;
-moz-border-radius: ;
}
Where is my problem? I tried all combinations of height I could think of..
Update Html for the popup:
<div id="hidden-BE" style="display:none;" class="popuptable">
<table border="0" width="400">
<tbody><tr>
<th colspan="2"> Kanton BE </th>
</tr>
<tr>
<td width="125px"><img src="http://www.personnes-histoirerurale.ch/pimages/ch/be.gif" width="125"></td>
<td valign="top">
<b>Auswahl (Total: 4)</b><br>
<ul>
<li>Laur, Ernst Ferdinand (1871-1964)</li>
<li>Landis, Jakob (1926-)</li>
<li>Lampert, Octave</li>
<li>Laur-Schaffner, Sophie (1875-1960)</li>
</ul>
</td>
</tr>
</tbody></table>
</div>
Here is one way of adjusting the layout to get a good image fit.
For the HTML, add valign="top" to the table cell holding the image:
<table border="0" width="400" class="popuptable">
<tbody>
<tr>
<th colspan="2">Kanton BE</th>
</tr>
<tr>
<td width="125px" valign="top">
<img src="http://www.personnes-histoirerurale.ch/pimages/ch/be.gif" width="125">
</td>
<td valign="top">
<b>Auswahl (Total: 4)</b>
<br>
<ul>
<li>Laur, Ernst Ferdinand (1871-1964)</li>
<li>Landis, Jakob (1926-)</li>
<li>Lampert, Octave</li>
<li>Laur-Schaffner, Sophie (1875-1960)</li>
</ul>
</td>
</tr>
</tbody>
</table>
For the CSS, make the following modifications:
table.popuptable td {
border-width: 1px;
padding: 0px; /* adds spacing above image, so remove... */
border-style: solid;
border-color: #2778AF !important;
background-color: white;
-moz-border-radius: ;
}
table.popuptable img {
display: block;
}
table.popuptable ul {
border: 1px dashed red;
margin: 0 ;
}
Use display: block on the img to get rid of the extra space below the baseline that gets inserted with inline elements.
You also have 2px padding in the table cells, which you may want to remove or keep as needed.
Finally, the default margins on the ul may cause the height of the text block to be higher than the image, so adjust those as necessary.
See fiddle: http://jsfiddle.net/audetwebdesign/HqQWY/
use the set of properties to make the image fit
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
Ditch the tables, do the pop-up with divs, set the image as background image for the div:
<div class="flag"></div>
And set background-size: cover;
http://www.w3schools.com/cssref/css3_pr_background-size.asp
Related
I have a strange formatting issue. I have an MVC application that uses Bootstrap 4. When I specify the width of the table using a style="width:xx%" attribute on the declaration, the background color of the caption row only extends across part of the table. If I don't specify the width, the background color works perfectly. I've attached a snip that displays an example of a table using auto width, and a table where I've set the width to 70%.
The container is "container-fluid body-content input-group-sm". The _layout.cshtml includes the following style tags, though I'm only referencing the "table mytable" style in this example, as you'll see in the View source below.
body {
padding-top: 5px;
margin-left: 10px;
font-size: 14px;
}
tr {
line-height: 10px;
min-height: 10px;
height: 10px;
/*padding: 0 !important;*/
}
td {
padding: 5px;
}
.table th,
.table td {
padding: 5px 8px;
}
.mytable>tbody>tr>td,
.mytable>tbody>tr>th,
.mytable>tfoot>tr>td,
.mytable>tfoot>tr>th,
.mytable>thead>tr>td,
.mytable>thead>tr>th {
padding: 4px;
}
.mytable {
margin-bottom: 2px;
border-width: 1px;
border-style: solid;
border-radius: 4px;
border-color: rgb(204, 204, 204);
display: inline-block;
margin-right: 2px;
width: auto;
margin-left: 15px;
}
.mytable caption {
caption-side: top;
background-color: #f5f5f5;
color: #333;
padding: 10px 15px;
font-size: 16px;
border-bottom: 1px solid transparent;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-color: rgb( 204, 204, 204);
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<div style="white-space:nowrap">
<h4>Test Page</h4>
<table class="table mytable">
<caption>My Caption - Table 1</caption>
<tr>
<th style="width:30%">Heading 1:</th>
<td>
Row 1
</td>
</tr>
<tr>
<th>Heading 2:</th>
<td>
Row 2
</td>
</tr>
</table>
<br />
<br />
<table class="table mytable" style="width:70%">
<caption>My Caption - Table 2</caption>
<tr>
<th style="width:30%">Heading 3:</th>
<td>
Row 3
</td>
</tr>
<tr>
<th>Heading 4:</th>
<td>
Row 4
</td>
</tr>
</table>
</div>
I'm absolutely no expert on style sheets, so if this is a newbie level question, I apologize. I've done quite a bit of googling to try and understand this, but have come up empty. Any hints on why this is happening, and suggestions on how to correct it would be most appreciated. Thanks!
Remove display: inline-block from .mytable class.
body {
padding-top: 5px;
margin-left: 10px;
font-size: 14px;
}
tr {
line-height: 10px;
min-height: 10px;
height: 10px;
/*padding: 0 !important;*/
}
td {
padding: 5px;
}
.table th,
.table td {
padding: 5px 8px;
}
.mytable>tbody>tr>td,
.mytable>tbody>tr>th,
.mytable>tfoot>tr>td,
.mytable>tfoot>tr>th,
.mytable>thead>tr>td,
.mytable>thead>tr>th {
padding: 4px;
}
.mytable {
margin-bottom: 2px;
border-width: 1px;
border-style: solid;
border-radius: 4px;
border-color: rgb(204, 204, 204);
margin-right: 2px;
width: auto;
margin-left: 15px;
}
.mytable caption {
caption-side: top;
background-color: #f5f5f5;
color: #333;
padding: 10px 15px;
font-size: 16px;
border-bottom: 1px solid transparent;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-color: rgb( 204, 204, 204);
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<div style="white-space:nowrap">
<h4>Test Page</h4>
<table class="table mytable">
<caption>My Caption - Table 1</caption>
<tr>
<th style="width:30%">Heading 1:</th>
<td>
Row 1
</td>
</tr>
<tr>
<th>Heading 2:</th>
<td>
Row 2
</td>
</tr>
</table>
<br />
<br />
<table class="table mytable" style="width:70%">
<caption>My Caption - Table 2</caption>
<tr>
<th style="width:30%">Heading 3:</th>
<td>
Row 3
</td>
</tr>
<tr>
<th>Heading 4:</th>
<td>
Row 4
</td>
</tr>
</table>
</div>
I have a HTML file in which the coding for the 'page' part is as below:
#page { margin: 2% 0% 0% 2%;}
.page { BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; WIDTH: 0px; BORDER-BOTTOM: 0px;}
.pageBreak{ page-break-before: always;position:relative; WIDTH: 0px; }
.page1 { BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; WIDTH: 675px; HEIGHT:900px; BORDER-BOTTOM: 0px;}
<table class="page1">
<tr>
<td colspan="2">
<div
style="z-index: 10; top: 10px; left: 14px; width: 730px; height: 1015px; border-color: #000000; border-style: solid; border-width: 1px;">
<table width="730px" height="1015px">
<tr>
<td> </td>
</tr>
</table>
</div>
//some code here......
</table>
<table class="page">
<tr>
<td colspan="2">
<div
style="z-index: 10; top: 10px; left: 14px; width: 730px; height: 1015px; border-color: #000000; border-style: solid; border-width: 1px;">
<table width="730px" height="1015px">
<tr>
<td> </td>
</tr>
</table>
</div>
//some code here......
</table>
Our client requirement is that when print option is selected as 'Shrink to Fit',the print preview and the print is displaying the page which is not getting fit to the A4 size width and height.It is leaving a lot of space at the right border and bottom. So,please suggest as what can be made to meet the requirement i.e. selecting the page with 'Shrink to Fit' should result in page occupying the 90% of whole A4 sheet leaving the other 10% for borders. The issue is observed for all the browser versions of IE and FF. Chrome is not in our scope.
I'm trying to make the black bar from the table td reach out all the way to the black border of the div. what am I doing wrong? I've been messing around with this for a while now and its starting to get to me. :( I've included all the css and html below. Hopefully someone can give me a hand with this. Thanks in advance!
<div style="background: #DCDCDC;border: 1px solid #000000;border-radius: 12px; vertical-align: top;width: 240px;height: 180px;">
<table width="100%">
<tr>
<td bgcolor="#000000" height="15"></td>
</tr>
<tr>
<td>f</td>
</tr>
</table>
</div>
You need overflow: hidden to hide the style outside of the parent.
border-spacing: 0 to remove the default spacing of the table.
* {
margin: 0;
padding: 0;
}
div {
background: #DCDCDC;
border: 1px solid #000000;
border-radius: 12px;
vertical-align: top;
width: 240px;
height: 180px;
overflow: hidden;
}
table {
border-spacing: 0;
width: 100%; }
<div>
<table>
<tr><td bgcolor="#000000" height="15"></td></tr>
<tr><td>f</td></tr>
</table>
</div>
I want to override the background of a table cell with a CSS definition, using class:
<table class="adminTable">
<thead>
<tr>
<th>Title</th>
<th align="center" width="50">%</th>
<th align="center">Actions</th>
</tr>
</thead>
<tbody>
<tr class="">
<td>Test</td>
<td align="center" class="IN_PROGRESS">27%</td>
<td align="center" width="175">
<a class="rounded-button" href="/admin/workflows/1/summary">Show</a>
<a class="rounded-button" href="/workflows/delete?id=1" class="button">Delete</a>
</td>
</tr>
</tbody>
</table>
The 'IN_PROGRESS' value varies with the different rows, and provides a colour indicating the status.
This is in my CSS style sheet:
.adminTable {
width: 100%;
border-width: 1px;
border-spacing: 2px;
border-style: outset;
border-color: gray;
border-collapse: separate;
background-color: WhiteSmoke ;
}
.adminTable th {
border-width: 1px;
padding: 5px;
border-style: dotted;
border-color: gray;
background-color: white;
-moz-border-radius: 10px;
}
.adminTable td {
border-width: 1px;
padding: 5px;
border-style: dotted;
border-color: gray;
background-color: white;
-moz-border-radius: 10px;
}
.IN_PROGRESS{
color:#FFFFFF;
background: DarkOrange;
}
Most of the time I just want the white background (and use this style all over my application), but here, and another few places I need to colour it. Is there an easy way to do this without having to duplicate the styles?
The problem is that .adminTable td is more specific (score {0}{1}{1}) than .IN_PROGRESS (score {0}{1}{0}).
Try td.IN_PROGRESS (score {0}{1}{1} but because it appears later in the CSS file it will win out) instead.
You should give complete css hierarchy for .IN_PROGRESS.
It will go as follows
.adminTable td.IN_PROGRESS {
color:#FFFFFF;
background: DarkOrange;
}
The mouseover function is not working with Google Chrome. Working fine with Firefox and IE. While mouseover the border bottom is not disappearing. But if removing border-collapse: collapse it's working fine. Why is this? Any solution.
css:
html, body{
margin: 0;
padding: 0;
}
.table {
border-collapse: collapse;
}
.border {
border-style: solid;
border-width: 1px;
border-color: #000000;
background-color: #deecf9;
border-left: 0px;
border-right: 0px;
}
.border1 {
border-style: solid;
border-width: 1px;
border-color: #000000;
background-color: #deecf9;
border-left: 0px;
border-right: 0px;
}
.border2 {
border-style: solid;
border-width: 1px;
border-color: #000000;
background-color: #FFFFFF;
border-left: 0px;
border-right: 0px;
border-bottom: 0px;
padding: 1px;
}
Table:
<table width="1024" border="0" align="center" bgcolor="#FFFFFF" class="table">
<tr>
<td height="9" colspan="4" class="border"></td>
</tr>
<tr>
<td class="border1" onmouseover="this.className='border2'" onmouseout="this.className='border1'"> </td>
<td class="border1" onmouseover="this.className='border2'" onmouseout="this.className='border1'"> </td>
<td class="border1" onmouseover="this.className='border2'" onmouseout="this.className='border1'"> </td>
<td class="border1" onmouseover="this.className='border2'" onmouseout="this.className='border1'"> </td>
</tr>
</table>
Do it like this: put an transparent border on your normal state elements.
When the :hover is applied the size of the border changes the size the element takes up.
eg:
.border1
{
border:1px solid #000000;
border-left:1px solid transparent;
border-right:1px solid transparent;
background-color: #FFFFFF;
}
.border1:hover
{
border:1px solid transparent;
border-top:1px solid #000000;
padding:1px;
background-color: #deecf9;
}
Your HTML should be something like:
<table width="1024" align="center" bgcolor="#FFFFFF" class="table">
<tr>
<td height="9" colspan="4" class="border"></td>
</tr>
<tr>
<td class="border1"> </td>
<td class="border1"> </td>
<td class="border1"> </td>
<td class="border1"> </td>
</tr>
</table>
No need to work with the mouseovers as an attribute, just use css.
Edit: i've noticed that you're using the css border-collapse property. This sets whether the table borders are collapsed into a single border or detached as in standard HTML. Try removing this line or set it to "separate", maybe this will work.