I have problem with my table. This table is primary for phones. When I have phone vertical, table is not showing thread, but when I have phone horizontally, it shows correctly.
Can anybody help me to display this table correctly on phones when phone is vertically?
body {
font-family: "Open Sans", sans-serif;
line-height: 1.25;
}
table {
border: 1px solid #ccc;
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
/*table-layout: fixed;*/
}
table caption {
font-size: 1.5em;
margin: .5em 0 .75em;
}
table tr {
background: #f9f9f9;
border: 1px solid #ddd;
padding: .35em;
}
table tr:hover {
background-color: #f5f5f5;
}
table th,
table td {
padding: .625em;
text-align: center;
}
table th {
font-size: .85em;
letter-spacing: .1em;
text-transform: uppercase;
background-color: #333333;
color: #fff;
}
#media screen and (max-width: 600px) {
table {
border: 0;
}
table caption {
font-size: 1.3em;
}
table thead {
border: none;
clip: rect(0 0 0 0);
height: 60px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
display: block;
width: 0px;
}
table tr {
border-bottom: 3px solid #ddd;
/*//spodok tabulky*/
display: block;
margin-bottom: .625em;
}
table td {
border-bottom: 1px solid #ddd;
/*Hrubka ciary medzi riadkam*/
display: block;
font-size: .8em;
text-align: center;
/*Pozicia textu*/
}
table td:before {
/*
* aria-label has no advantage, it won't be read inside a table
content: attr(aria-label);
*/
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
table td:nth-child(even) {
background-color: #f2f2f2;
}
}
<table>
<thead>
<tr>
<!--<th>Poradie</th>-->
<th>Císlo zákazky</th>
<th>Pozícia</th>
<th>Poradové císlo</th>
<th>Stav</th>
</tr>
</thead>
</table>
Thank you for your response.
That's a simple fix. Remove clip: rect(0 0 0 0); and width: 0px;. Those lines hides the entire thead because the #media condition kicks in in portrait mode (narrower screen).
You might want to redo the entire #media section of your css - it's overall a bit weird. Maybe add a couple of details what you originally intended to do on narrow screens.
body {
font-family: "Open Sans", sans-serif;
line-height: 1.25;
}
table {
border: 1px solid #ccc;
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
/*table-layout: fixed;*/
}
table caption {
font-size: 1.5em;
margin: .5em 0 .75em;
}
table tr {
background: #f9f9f9;
border: 1px solid #ddd;
padding: .35em;
}
table tr:hover {
background-color: #f5f5f5;
}
table th,
table td {
padding: .625em;
text-align: center;
}
table th {
font-size: .85em;
letter-spacing: .1em;
text-transform: uppercase;
background-color: #333333;
color: #fff;
}
#media screen and (max-width: 600px) {
table {
border: 0;
}
table caption {
font-size: 1.3em;
}
table thead {
border: none;
height: 60px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
display: block;
}
table tr {
border-bottom: 3px solid #ddd;
/*//spodok tabulky*/
display: block;
margin-bottom: .625em;
}
table td {
border-bottom: 1px solid #ddd;
/*Hrubka ciary medzi riadkam*/
display: block;
font-size: .8em;
text-align: center;
/*Pozicia textu*/
}
table td:before {
/*
* aria-label has no advantage, it won't be read inside a table
content: attr(aria-label);
*/
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
table td:nth-child(even) {
background-color: #f2f2f2;
}
}
<table>
<thead>
<tr>
<!--<th>Poradie</th>-->
<th>Císlo zákazky</th>
<th>Pozícia</th>
<th>Poradové císlo</th>
<th>Stav</th>
</tr>
</thead>
</table>
Lets just remove thead position and display rules.
Now we can see the thead. The you can add the remaining styles.
Hope this is what you were looking for. Happy to explain or help in a better solution if needed.
body {
font-family: "Open Sans", sans-serif;
line-height: 1.25;
}
table {
border: 1px solid #ccc;
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
/*table-layout: fixed;*/
}
table caption {
font-size: 1.5em;
margin: .5em 0 .75em;
}
table tr {
background: #f9f9f9;
border: 1px solid #ddd;
padding: .35em;
}
table tr:hover {
background-color: #f5f5f5;
}
table th,
table td {
padding: .625em;
text-align: center;
}
table th {
font-size: .85em;
letter-spacing: .1em;
text-transform: uppercase;
background-color: #333333;
color: #fff;
}
#media screen and (max-width: 600px) {
table {
border: 0;
}
table caption {
font-size: 1.3em;
}
table thead {
border: none;
clip: rect(0 0 0 0);
height: 60px;
margin: -1px;
overflow: hidden;
padding: 0;
width: 0px;
}
table tr {
border-bottom: 3px solid #ddd;
/*//spodok tabulky*/
display: block;
margin-bottom: .625em;
}
table td {
border-bottom: 1px solid #ddd;
/*Hrubka ciary medzi riadkam*/
display: block;
font-size: .8em;
text-align: center;
/*Pozicia textu*/
}
table td:before {
/*
* aria-label has no advantage, it won't be read inside a table
content: attr(aria-label);
*/
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
table td:nth-child(even) {
background-color: #f2f2f2;
}
}
<table>
<thead>
<tr>
<!--<th>Poradie</th>-->
<th>Císlo zákazky</th>
<th>Pozícia</th>
<th>Poradové císlo</th>
<th>Stav</th>
</tr>
</thead>
</table>
Related
Disclaimer - I know very little about CSS.
I'm interesting in using jemdoc's CSS (https://jemdoc.jaboc.net/jemdoc.css) with HTML5 exported from emacs org-mode. However I believe emacs org-mode exports a "table-of-contents" rather than a "menu" (which is generated from a separate file with jemdoc), but I would like it if the table of contents could be displayed in the sidebar like the menu. Can this be modified to accept a table of contents? I believe this is the relevant part of the jemdoc CSS.
table#tlayout {
border: none;
border-collapse: separate;
background: white;
}
body {
background: white;
font-family: Georgia, serif;
padding-bottom: 8px;
margin: 0;
}
#layout-menu {
background: #f6f6f6;
border: 1px solid #dddddd;
padding-top: 0.5em;
padding-left: 8px;
padding-right: 8px;
font-size: 1.0em;
width: auto;
white-space: nowrap;
text-align: left;
vertical-align: top;
}
#layout-menu td {
background: #f4f4f4;
vertical-align: top;
}
#layout-content {
padding-top: 0.0em;
padding-left: 1.0em;
padding-right: 1.0em;
border: none;
background: white;
text-align: left;
vertical-align: top;
}
#layout-menu a {
line-height: 1.5em;
margin-left: 0.5em;
}
tt {
background: #ffffdd;
}
pre, tt {
font-size: 90%;
font-family: monaco, monospace;
}
a, a > tt {
color: #224b8d;
text-decoration: none;
}
a:hover {
border-bottom: 1px gray dotted;
}
#layout-menu a.current:link, #layout-menu a.current:visited {
color: #022b6d;
border-bottom: 1px gray solid;
}
#layout-menu a:link, #layout-menu a:visited, #layout-menu a:hover {
color: #527bbd;
text-decoration: none;
}
#layout-menu a:hover {
text-decoration: none;
}
div.menu-category {
border-bottom: 1px solid gray;
margin-top: 0.8em;
padding-top: 0.2em;
padding-bottom: 0.1em;
font-weight: bold;
}
div.menu-item {
padding-left: 16px;
text-indent: -16px;
}
Currently I use something like this to display my org-mode at the top of the HTML5 page (which I also copied from another CSS file).
#table-of-contents {
display: table;
width: 350px;
border: 1px solid #aaa;
margin-top: 3ex;
padding: 10px 10px 10px 0px;
}
#table-of-contents h2 {
border: 0;
text-align: center;
list-style-type: none;
}
I am using Nreco PdfGenerator to generate pdf from HTML. Everything is fine but characters are so close to each other and it is not easy to read.
Is there any way to fix this issue?
HTML version
PDF version
This is my CSS
<style type="text/css" media="screen">
body { line-height: 18px; font-family: Arial, sans-serif; font-size: 12px; background: #fff; text-rendering: optimizeSpeed; }
.topButton { width: 880px; margin: 0 auto; padding: 10px; background: #fff; border-bottom: 2px solid #007182; }
.mainTable { width: 880px; margin: 0 auto; padding: 10px; background: #fff; /*border: 1px solid red;*/ }
.just { text-align: justify; }
.detailItinerary { width: 100%; border: 10px solid red; }
.dailyTitle { color: #4C9897; margin-top: 10px; display: block; font-size: 12px; }
.serviceRowsWithBorder { width: 100%; border-bottom: 1px solid #007182; padding: 10px 0; }
.serviceRowsWithoutBorder { width: 100%; padding: 10px 0; }
.topLink { text-decoration: none; color: #C74E1B; }
</style>
<style media="print">
.topButton { display: none; }
#page { size: auto; margin: 7mm; }
body { background: #fff; margin: 0; font-family: Arial, sans-serif; font-size: 12px; text-rendering: optimizeSpeed; }
.mainTable { width: 100%; margin: 0 auto; padding: 10px; background: #fff; /*border: 1px solid red;*/ }
.just { text-align: justify; }
.dailyTitle { color: #4C9897; margin-top: 10px; display: block; font-size: 12px; }
.serviceRowsWithBorder { width: 100%; border-bottom: 1px solid #007182; padding: 10px 0; }
.serviceRowsWithoutBorder { width: 100%; padding: 10px 0; }
</style>
Setting the 'CustomWkHtmlArgs' property with the "--dpi 300" option fixed this problem for me, e.g.
return new HtmlToPdfConverter
{
Orientation = PageOrientation.Portrait,
PageHeaderHtml = "<br/>",
PageFooterHtml = "<div style=\"font-family: Arial;\">Page: <span class=\"page\"></span> of <span class=\"topage\"></span></div>",
CustomWkHtmlArgs = "--dpi 300",
};
This is very vaguely explained on the NReco PDF website, but without it actually explaining how to set the property.
I'm probably missing something terribly obvious but I can't hack my way into the proper layout for my table. I have some nested tables. The innermost tables are all class=cell and I want to control the padding for the td elements in these tables. Here is the CSS:
.cell
{
border-collapse: collapse;
border: 2px solid black;
margin: 5px;
}
.cell td
{
border-collapse: collapse;
border: 2px solid black;
text-align: center;
vertical-align: middle;
height: 24px;
}
When I add this to either selection above it has no effect on the table:
padding-left: 30px;
padding-right: 30px;
padding-top: 0px;
padding-bottom: 0px;
I have no other CSS that affects the td element. What am I doing wrong?
Thanks.
EDIT: Here is the complete CSS. It is applied to a set of nested tables. The outer, containing table is class=outer. It contains two tables for the left and right columns and in the columns the tables with class=cell are stacked on top of each other:
.outer
{
border: none;
margin-left: auto;
margin-right: auto;
}
.outer td
{
vertical-align: top;
}
.column
{
border: none;
}
#rightColumn table, #leftColumn table
{
width: 100%;
}
.cell
{
border-collapse: collapse;
border: 2px solid black;
margin: 5px;
}
.cell td
{
border-collapse: collapse;
border: 2px solid black;
text-align: center;
vertical-align: middle;
height: 24px;
padding-left: 3px;
padding-right: 3px;
}
.image
{
padding: 0;
margin: 0;
width: 75px;
}
.messages td
{
border-collapse: collapse;
border: 2px solid #FF0000;
text-align: left;
}
h1
{
text-align: center;
font-size: 350%;
}
h2
{
text-align: center;
}
th
{
background-color: #2B60DE;
color: #FFFFFF;
}
.gray
{
background-color: #AAAAAA;
}
.blue
{
background-color: #2B60DE;
}
.orange
{
background-color: #FFA500;
}
.green
{
background-color: #00FF00;
}
.red
{
background-color: #FF0000;
}
.yellow
{
background-color: #FFFF00;
}
.white
{
background-color: #FFFFFF;
}
.cell .span2
{
vertical-align: bottom;
}
.centered
{
text-align: center;
padding: 10px;
}
Try adding position: relative; to the css rules you have. + it would be nice to actually see your html.
I'm using Devexpress's MVC exctensions within my MVC3 w/razor project. I have data grids using Devexpress's MVC extensions and also basic html tables without any styling.
Is there a way to apply the devexpress styles to my html tables for a consistent look?
You can use css to style a grid then follow the same principle for a table. Here is a style for a grid I created then styles for a similar looking table
/************************GRID STYLE************************************/
.mGrid
{
width: 100%;
background-color: #fff;
margin: 5px 0 5px 0;
border: solid 1px #525252;
border-collapse: collapse;
font-size: 13px; /*width: 820px;*/
text-align: center;
}
.mGrid td
{
padding: 2px;
border: solid 1px #c1c1c1;
color: #717171;
height: 20px;
}
.mGrid th
{
padding: 4px 2px;
color: #fff;
background: #424242 url(images/grd_head.png) repeat-x top;
border-left: solid 1px #525252;
height: 20px; /*font-size: 15px; */
}
.mGrid .alt
{
background: #fcfcfc url(images/grd_alt.png) repeat-x top;
}
.mGrid .pgr
{
background: #424242 url(images/grd_pgr.png) repeat-x top;
text-align: left;
}
.mGrid .pgr table
{
margin: 5px 0;
}
.mGrid .pgr td
{
border-width: 0;
padding: 0 6px;
border-left: solid 1px #666;
font-weight: bold;
color: #fff;
line-height: 12px;
}
.mGrid .pgr a
{
color: #666;
text-decoration: none;
font-size: 13px;
}
.mGrid .pgr a:hover
{
color: #AED434;
text-decoration: none;
font-size: 13px;
}
/************************END GRID STYLE************************************/
/************************mGrid Table Look alike STYLE************************************/
.mGridLookAlikeTable
{
width: 100%;
background-color: #fff;
margin: 5px 0 5px 0;
border: solid 1px #525252;
border-collapse: collapse;
font-size: 13px;
/*width: 820px;*/
text-align: center;
}
.mGridLookAlikeTable td
{
padding: 2px;
border: solid 1px #c1c1c1;
color: #717171;
height: 20px;
}
.mGridLookAlikeTable th
{
padding: 4px 2px;
color: #fff;
background: #424242 url(images/grd_head.png) repeat-x top;
border-left: solid 1px #525252;
height: 20px; /*font-size: 15px; */
}
/************************END mGrid Table Look alike STYLE************************************/
After a lot of search and tests, i still can not fix this ui problems.
1. symptom
jQuery plugin datepicker display different in firefox and ie.you could view the pic by clicking FF and IE.
You could see that in ie browser the select month and year displays improperly, background color is different in ff, and in FF the datepicker seems more clearly. I don't know why.
2. css code
The datePicker you could download at http://keith-wood.name/datepick.html. My code is below,html page is:
<style type="text/css">
#import "datePicker/redmond.datepick.css";
</style>
<span id="calendar" class="datepickHideCalendar">
<p>start date</p><p><input type="text" id="popupDatepickerStart"></p>
<p>end date</p><p><input type="text" id="popupDatepickerEnd"></p>
<table align="center"><tr><td><button type="button" id="getDates">run</button></td> </tr></table>
</span>
the redmond.datepick.css is as below:
/* Redmond style sheet for jQuery Datepicker v4.0.5. */
#charset "utf-8";
.datepick {
background-color: #fff;
color: #222;
border: 1px solid #4297d7;
border-radius: 0.25em;
-moz-border-radius: 0.25em;
-webkit-border-radius: 0.25em;
font-family: Arial,Helvetica,Sans-serif;
font-size: 70%;
}
.datepick-rtl {
direction: rtl;
}
.datepick-popup {
z-index: 1000;
}
.datepick-disable {
position: absolute;
z-index: 100;
background-color: white;
opacity: 0.5;
filter: alpha(opacity=50);
}
.datepick a {
color: #222;
text-decoration: none;
}
.datepick a.datepick-disabled {
color: #888;
cursor: auto;
}
.datepick button {
margin: 0.25em;
padding: 0.125em 0em;
background-color: #5c9ccc;
color: #fff;
border: none;
border-radius: 0.25em;
-moz-border-radius: 0.25em;
-webkit-border-radius: 0.25em;
font-weight: bold;
}
.datepick-nav, .datepick-ctrl {
float: left;
width: 100%;
background-color: #fff;
font-size: 90%;
font-weight: bold;
}
.datepick-ctrl {
background-color: #d0e5f5;
}
.datepick-cmd {
width: 30%;
}
.datepick-cmd:hover {
background-color: #dfeffc;
}
button.datepick-cmd:hover {
background-color: #79b7e7;
}
.datepick-cmd-prevJump, .datepick-cmd-nextJump {
width: 8%;
}
a.datepick-cmd {
height: 1.5em;
}
button.datepick-cmd {
text-align: center;
}
.datepick-cmd-prev, .datepick-cmd-prevJump, .datepick-cmd-clear {
float: left;
padding-left: 2%;
}
.datepick-cmd-current, .datepick-cmd-today {
float: left;
width: 35%;
text-align: center;
}
.datepick-cmd-next, .datepick-cmd-nextJump, .datepick-cmd-close {
float: right;
padding-right: 2%;
text-align: right;
}
.datepick-rtl .datepick-cmd-prev, .datepick-rtl .datepick-cmd-prevJump,
.datepick-rtl .datepick-cmd-clear {
float: right;
padding-left: 0%;
padding-right: 2%;
text-align: right;
}
.datepick-rtl .datepick-cmd-current, .datepick-rtl .datepick-cmd-today {
float: right;
}
.datepick-rtl .datepick-cmd-next, .datepick-rtl .datepick-cmd-nextJump,
.datepick-rtl .datepick-cmd-close {
float: left;
padding-left: 2%;
padding-right: 0%;
text-align: left;
}
.datepick-month-nav {
float: left;
text-align: center;
}
.datepick-month-nav div {
float: left;
width: 12.5%;
margin: 1%;
padding: 1%;
}
.datepick-month-nav span {
color: #888;
}
.datepick-month-row {
clear: left;
}
.datepick-month {
float: left;
width: 15em;
border: 1px solid #5c9ccc;
text-align: center;
font-size: 90%;
}
.datepick-month-header, .datepick-month-header select, .datepick-month-header input {
height: 1.7em;
background-color: #5c9ccc;
color: #fff;
font-weight: bold;
}
.datepick-month-header select, .datepick-month-header input {
height: 1.7em;
border: none;
}
.datepick-month-header input {
position: absolute;
display: none;
}
.datepick-month table {
width: 100%;
border-collapse: collapse;
}
.datepick-month thead {
border-bottom: 1px solid #aaa;
}
.datepick-month th, .datepick-month td {
margin: 0em;
padding: 0em;
font-weight: normal;
text-align: center;
}
.datepick-month th {
border: 1px solid #fff;
border-bottom: 1px solid #c5dbec;
}
.datepick-month td {
border: 1px solid #c5dbec;
}
.datepick-month td.datepick-week * {
background-color: #d0e5f5;
color: #222;
border: none;
}
.datepick-month a {
display: block;
width: 100%;
padding: 0.125em 0em;
background-color: #dfeffc;
color: #000;
text-decoration: none;
}
.datepick-month span {
display: block;
width: 100%;
padding: 0.125em 0em;
}
.datepick-month td span {
color: #888;
}
.datepick-month td .datepick-other-month {
background-color: #fff;
}
.datepick-month td .datepick-today {
background-color: #fad42e;
}
.datepick-month td .datepick-highlight {
background-color: #79b7e7;
}
.datepick-month td .datepick-selected {
background-color: #4297d7;
color: #fff;
}
.datepick-status {
clear: both;
text-align: center;
}
.datepick-clear-fix {
clear: both;
}
.datepick-cover {
display: none;
display/**/: block;
position: absolute;
z-index: -1;
filter: mask();
top: -1px;
left: -1px;
width: 100px;
height: 100px;
}
.datepickShowCalendar{visibility:visible}
.datepickHideCalendar{visibility:hidden}
.datePickerTitle{text-align:center;font-size:14px;font-weight:bold}
.datePickerBtn{font-size:12px}
/* CSS Document */
BODY {
background-color:#FAFAFA;
}
#calendar{font-size:12px;text-align:center}
TABLE {
FONT-SIZE: 12px;
FONT-FAMILY: "微软雅黑", "宋体", "Arial", "Verdana"
}
TD {
FONT-SIZE: 12px;
FONT-FAMILY: "微软雅黑", "宋体", "Arial", "Verdana";
}
P {
FONT-SIZE: 12px;
FONT-FAMILY: "微软雅黑", "宋体", "Arial", "Verdana";
color: #003B7F;
}
SELECT {
FONT-SIZE: 12px;
FONT-FAMILY: "微软雅黑", "宋体", "Arial", "Verdana"
}
INPUT {
FONT-SIZE: 12px;
FONT-FAMILY: "微软雅黑", "宋体", "Arial", "Verdana"
}
TEXTAREA {
FONT-SIZE: 12px;
FONT-FAMILY: "微软雅黑", "宋体", "Arial", "Verdana"
}
DIV {
FONT-SIZE: 12px;
FONT-FAMILY: "微软雅黑", "宋体", "Arial", "Verdana"
}
TABLE {
WORD-BREAK: break-all;
BORDER-COLLAPSE: collapse;
text-align: center;
}
UL {
PADDING-RIGHT: 0px;
PADDING-LEFT: 0px;
PADDING-BOTTOM: 0px;
MARGIN: 0px;
PADDING-TOP: 0px;
LIST-STYLE-TYPE: none
}
LI {
PADDING-RIGHT: 0px;
PADDING-LEFT: 0px;
PADDING-BOTTOM: 0px;
MARGIN: 0px;
PADDING-TOP: 0px;
LIST-STYLE-TYPE: none
}
FORM {
margin:0px;
LIST-STYLE-TYPE: none
}
FORM {
PADDING-RIGHT: 0px;
PADDING-LEFT: 0px;
PADDING-BOTTOM: 0px;
MARGIN: 0px;
PADDING-TOP: 0px
}
SELECT {
PADDING-RIGHT: 0px;
PADDING-LEFT: 0px;
PADDING-BOTTOM: 0px;
MARGIN: 0px;
PADDING-TOP: 0px
}
A IMG {
BORDER-RIGHT: 0px;
BORDER-TOP: 0px;
BORDER-LEFT: 0px;
BORDER-BOTTOM: 0px
}
A:link {
color:#000066;
TEXT-DECORATION: none
}
A:visited {
TEXT-DECORATION: none
}
A:active {
TEXT-DECORATION: none
}
A:hover {
TEXT-DECORATION: none
}
INPUT {
MARGIN-RIGHT: 5px;
margin-top: 3px;
}
TEXTAREA {
VERTICAL-ALIGN: middle;
MARGIN-RIGHT: 5px
}
SELECT {
VERTICAL-ALIGN:middle;
MARGIN-RIGHT: 5px;
opacity: 1;
}
TEXTAREA {
BORDER: #999999 1px solid;
PADDING-LEFT: 3px;
OVERFLOW: auto;
COLOR: #000;
BACKGROUND-COLOR: #fff
}
.datalist_table{
width:100%;
border:0px;
}
.datalist_table Th {
FONT-WEIGHT: bold;
COLOR: #034579;
HEIGHT: 26px;
text-align:left;
vertical-align:middle;
background:#F0F0F0;
}
.datalist_table TD {
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
HEIGHT: 26px;
TEXT-ALIGN: center;
color: #003b7f;
}.datalist_table TD {
PADDING-RIGHT: 3px;
PADDING-LEFT: 3px;
HEIGHT: 26px;
TEXT-ALIGN: center;
color: #003b7f;
}
.list01 {
background:#E4EEF3;
}
.list02 {
background:#D6E4EB
}
i want to know which part of the css is wrong? Why IE displays improperly? Thank you guys.