CSS正文宽度不会达到100%

Cal*_*ald 7 html css

我正在开发一个网页,我注意到了这个问题.

身体全宽问题打印屏幕 请发布您想到的任何内容,这将非常有帮助!

这里查看网站

编辑:添加了网站链接

Jas*_*rst 19

可能想检查这是否可行,它确实针对我的特定问题。

body {
    min-width: fit-content;
}
Run Code Online (Sandbox Code Playgroud)

添加了 John Mcnulty 的答案作为粘贴,因为网络链接可能会变成 404。这实际上有助于规范化 css,而无需浏览器将自己的 css 放入其中。

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
Run Code Online (Sandbox Code Playgroud)

  • 我不知道为什么身体不尊重宽度而不得不强制使用 min-width: fit-content 但它有效...... (2认同)

Moh*_*ari 6

你需要使用CSS 重置

使用此代码:

body, html{
    margin:0;
    padding:0;
}
Run Code Online (Sandbox Code Playgroud)

默认情况下,所有元素都有一些样式,您需要重置它们。


小智 -1

您的页面中是否包含 CSS 重置?

http://meyerweb.com/eric/tools/css/reset/