如何应用“@media only screen and(max width:500px)”重新定位没有ID的HTML元素?

如何应用“@media only screen and(max width:500px)”重新定位没有ID的HTML元素?,html,css,anki,Html,Css,Anki,我正在尝试这样做,如果屏幕关闭,您可以按类或标记本身重新定位元素,例如表{margin top:5px},尽管这会影响页面中的所有表。也许父元素有一个ID?然后你可以使用ParentID表{}…所以我尝试了@media-only-screen和max-width:500px{table{margin-top:5px!important;}}这不起作用,我也尝试了用HTML分配一个ID,然后@media-only-screen和max-width:500px{TagBox{margin-top:5

我正在尝试这样做,如果屏幕关闭,您可以按类或标记本身重新定位元素,例如表{margin top:5px},尽管这会影响页面中的所有表。也许父元素有一个ID?然后你可以使用ParentID表{}…所以我尝试了@media-only-screen和max-width:500px{table{margin-top:5px!important;}}这不起作用,我也尝试了用HTML分配一个ID,然后@media-only-screen和max-width:500px{TagBox{margin-top:5px!important;}当你在浏览器中打开你的页面时,右键单击表格并从弹出菜单中选择Inspect element Chrome/Opera,在其他浏览器中可能会有不同的调用。然后在inspector中选中/取消选中您的样式,看看是否有任何东西可以解决您的问题。
<table style="width: 100%; border-style: hidden; border-collapse: collapse; text-align: left;">
<tbody>
<tr>
<td><b id="tags-container">{{Tags}}</b></td>
</tr>
</tbody>
</table>
/* TAGS */
kbd {
  display: inline-block;
  letter-spacing: .2px;
  font-weight: bold;
  font-size: 12px !important;
  text-shadow: none !important;
  padding: 0.0rem 0.1rem !important;
  margin: 1px !important;
  border-radius: 4px;
  border-width: 1.5px !important;
  border-style: solid;
  background-color: transparent !important;
  box-shadow: none !important;
  opacity: 0.5;
   word-break: break-all;
}


/* Tag Becomes More Visible On Hover */
kbd:hover { opacity: 1; transition: opacity 0.2s ease; }


/* Tag Colors */
kbd:nth-of-type(1n+0) { border-color: #fc00ff; color: #fc00ff;}
kbd:nth-of-type(2n+0) { border-color: #03A9F4; color: #03A9F4;}
kbd:nth-of-type(3n+0) { border-color: #FF0000; color: #FF0000;}
kbd:nth-of-type(4n+0) { border-color: #faed27; color: #faed27;}
kbd:nth-of-type(5n+0) { border-color: #FF9933; color: #FF9933}
kbd:nth-of-type(6n+0) { border-color: #ff6ec7; color: #ff6ec7; }
kbd:nth-of-type(7n+0) { border-color: #8ffcff; color: #8ffcff; }
kbd:nth-of-type(8n+0) { border-color: #ff009a; color: #ff009a; }
kbd:nth-of-type(9n+0)  { border-color: #39ff14; color: #39ff14; }
kbd:nth-of-type(10n+0) { border-color: #1b03a3; color: #1b03a3; }

/* Tag Mobile Adjustments */
.mobile kbd { opacity: .9; margin: 1px !important; display: inline-block; font-size: 14px !important; margin-top: 5px !important;}
.mobile #tags-container {line-height:0.6rem; margin-left: 0px; }