无法从导航栏中删除白色 space(左侧和右侧)
Can't remove white space (left and right sides) from Navbar
我对 HTML 编程还很陌生。我正在使用 blogger 创建我的第一个导航栏,但我无法删除 blogger 设置的默认白色 space(左侧和右侧)。这是我的博客 link。我也确实使用了浏览器检查工具,但找不到导致问题的原因。这是我的博主 link:https://nainghtooaung2.blogspot.com/
我确实用过position:relative;调整 alignment.Although 代码将导航栏向左移动而没有任何白色 space,它会在右侧创建更多的白色 space。这意味着我使用的代码只是移动了导航栏的位置,但没有删除白色 space.
当我尝试使用 position:fixed 时,它从导航栏中删除了所有白色 space。但是我的导航栏和其他内容重叠了。
.site-nav {
position:relative;
left:0;
width:100%
)
.site-nav {
position:fixed;
left:0;
width:100%
)
将此 class 添加到您的 CSS 样式表:
body { margin: 0; }
浏览器使用不同的值初始化 CSS 属性,您应该使用 normalize 或类似的库来重置所有这些值,然后您可以添加自己的自定义 classes。
始终在样式开头添加浏览器重置 CSS 代码 sheet:
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;
}
我对 HTML 编程还很陌生。我正在使用 blogger 创建我的第一个导航栏,但我无法删除 blogger 设置的默认白色 space(左侧和右侧)。这是我的博客 link。我也确实使用了浏览器检查工具,但找不到导致问题的原因。这是我的博主 link:https://nainghtooaung2.blogspot.com/
我确实用过position:relative;调整 alignment.Although 代码将导航栏向左移动而没有任何白色 space,它会在右侧创建更多的白色 space。这意味着我使用的代码只是移动了导航栏的位置,但没有删除白色 space.
当我尝试使用 position:fixed 时,它从导航栏中删除了所有白色 space。但是我的导航栏和其他内容重叠了。
.site-nav {
position:relative;
left:0;
width:100%
)
.site-nav {
position:fixed;
left:0;
width:100%
)
将此 class 添加到您的 CSS 样式表:
body { margin: 0; }
浏览器使用不同的值初始化 CSS 属性,您应该使用 normalize 或类似的库来重置所有这些值,然后您可以添加自己的自定义 classes。
始终在样式开头添加浏览器重置 CSS 代码 sheet:
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;
}