问题出在响应式表格更改jQuery CSS。

huangapple go评论71阅读模式
英文:

Issue with responsive table changing jquery css

问题

我已经包含了CSS以使表格具有响应式功能但这会导致具有日期选择器的<td>单元格在单行中显示每个月的日期

table {
	border-collapse: collapse;
	margin: 0;
	padding: 0;
	width: 100%;
}
table caption {
	font-size: 1.5em;
	margin: .5em 0 .75em;
}
table tr {
	padding: .35em;
}
table th, table td {
	padding: 625em;
	text-align: center;
}
table th {
	font-size: .85em;
	letter-spacing: .1em;
	text-transform: uppercase;
}
@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: 1px;
		margin: 1px;
		overflow: hidden;
		padding: 0;
		position: absolute;
		width: 1px;
	}
	table tr {
		display: block;
		margin-bottom: .625em;
	}
	table td {
		display: block;
		font-size: .8em;
		text-align: right;
	}
	table td::before {
		content: attr(data-label);
		float: left;
		font-weight: bold;
		text-transform: uppercase;
	}
	table td:last-child {
		border-bottom: 0;
	}
}
英文:

I have included the css to make the table responsive but this makes the td that has the datepicker to display days of the month in single lines

table {
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
}
table caption {
font-size: 1.5em;
margin: .5em 0 .75em;
}
table tr {
padding: .35em;
}
table th,table td {
padding: 625em;
ext-align: center;
}
table th {
font-size: .85em;
letter-spacing: .1em;
text-transform: uppercase;
}
@media screen and (max-width: 600px) {
table {
border: 0;
}
table caption {
font-ize: 1.3em;
}
table thead {
border: none;
clip: rect(0 0 0 0);
height: 1px;
margin: 1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
table tr {
display: block;
margin-bottom: .625em;
}
table td {
display: block;
font-size: .8em;
text-align: right;
}
table td::before {
content: attr(data-label);
float: left;
font-weight: bold;
text-transform: uppercase;
}
table td:last-child {
border-bottom: 0;
}
}

问题出在响应式表格更改jQuery CSS。

问题出在响应式表格更改jQuery CSS。

答案1

得分: 0

不要回答我要翻译的问题。以下是要翻译的内容:

"Instead of changing every table element in your html, you need to be a bit more specific. Give the table you're trying to make responsive a class, ie myresponsivetable

<table class="myresponsivetable"> ... </table>

then adjust your CSS accordingly:

table.myresponsivetable {
    border-collapse: collapse;
    margin: 0;
    padding: 0;
    width: 100%;
}
table.myresponsivetable caption {
    font-size: 1.5em;
    margin: .5em 0 .75em;
}
table.myresponsivetable tr {
    padding: .35em;
}
table.myresponsivetable th, table.myresponsivetable td {
    padding: 625em;
    text-align: center;
}
table.myresponsivetable th {
    font-size: .85em;
    letter-spacing: .1em;
    text-transform: uppercase;
}
@media screen and (max-width: 600px) {
    table.myresponsivetable {
        border: 0;
    }
    table.myresponsivetable caption {
        font-size: 1.3em;
    }
    table.myresponsivetable thead {
    ... and so on ...
}

This CSS will then not apply to the datepicker"

英文:

Instead of changing every table element in your html, you need to be a bit more specific. Give the table you're trying to make responsive a class, ie myresponsivetable

&lt;table class=&quot;myresponsivetable&quot;&gt; ... &lt;/table&gt;

then adjust your CSS accordingly:

 table.myresponsivetable {
border-collapse: collapse;
margin: 0;
padding: 0;
width: 100%;
}
table.myresponsivetable caption {
font-size: 1.5em;
margin: .5em 0 .75em;
}
table.myresponsivetable tr {
padding: .35em;
}
table.myresponsivetable th,table.myresponsivetable td {
padding: 625em;
ext-align: center;
}
table.myresponsivetable th {
font-size: .85em;
letter-spacing: .1em;
text-transform: uppercase;
}
@media screen and (max-width: 600px) {
table.myresponsivetable {
border: 0;
}
table.myresponsivetable caption {
font-ize: 1.3em;
}
table.myresponsivetable thead {
... and so on ...

This CSS will then not apply to the datepicker

huangapple
  • 本文由 发表于 2020年1月4日 11:52:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/59587738.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定