【发布时间】:2022-11-02 08:24:32
【问题描述】:
我想放置一个以常规尺寸为中心的媒体尺寸,当我将它的最大宽度更改为 480 时,标题在左侧。
但它卡在左边。如何更改代码以使标题在媒体大小时位于中间?
caption {
font-family: "Rock Salt", cursive;
padding: 20px;
font-style: italic;
caption-side: Top;
color: #666;
text-align: center;
letter-spacing: 1px;
}
@media only screen and (max-width: 480px) {
caption {
caption-side: Top;
text-align: center;
letter-spacing: 1px;
}
<section id="right">
<table>
<caption>Books everyone will enjoy!</caption>
<thead>
<th colspan="4">Recommended childrens books!</th>
<th colspan="2" style="display: none">Recommended childrens books!</th>
<tr>
<th colspan="1">Front of the book</th>
<th colspan="1">Title of the book</th>
<th colspan="1">Authors</th>
<th colspan="1">Book Summary</th>
</tr>
</thead>
【问题讨论】:
-
请添加您的问题的图片,最好是可以运行的代码
-
看起来像这样imgur.com/a/AQxPtl8,我不确定可以运行的代码是什么?该代码以常规大小工作。但是当我尝试以移动尺寸运行它时,它仍然停留在左侧的 @media only 屏幕和 (max-width: 480px) { caption { caption-side: Top;文本对齐:居中;字母间距:1px; }