Html 在chrome和firefox上显示不同的图像,使用flexbox调整大小
好的,所以我制作了一个照片库(我在这里更改了代码中的图片和标题),并使用flexbox在页面的左半部和右半部交替排列照片及其描述这在firefox中似乎工作得很好,但当我试图在chrome中打开它时,图像的大小没有正确缩放,页面也不相称。 我甚至使用了一个重置css文件,但显然这不起作用 我似乎不明白为什么它在chrome上不起作用;我使用flexbox的“flex:050%”让图像和标题(段落)占据各自的一半 我真的没想到chrome和firefox之间会有任何区别,两者都是非常标准的浏览器。另外,我在三台不同的电脑上试用了chrome浏览器(两台在windows上,一台在ubuntu上),它们都有相同的问题。为什么会这样 我对CSS有点陌生,所以如果有人也能指出我代码中的任何其他问题,那就太好了,欢迎所有评论:) 我将此网站放在github上,以便您可以轻松查看: 主CSS文件:Html 在chrome和firefox上显示不同的图像,使用flexbox调整大小,html,css,google-chrome,firefox,flexbox,Html,Css,Google Chrome,Firefox,Flexbox,好的,所以我制作了一个照片库(我在这里更改了代码中的图片和标题),并使用flexbox在页面的左半部和右半部交替排列照片及其描述这在firefox中似乎工作得很好,但当我试图在chrome中打开它时,图像的大小没有正确缩放,页面也不相称。 我甚至使用了一个重置css文件,但显然这不起作用 我似乎不明白为什么它在chrome上不起作用;我使用flexbox的“flex:050%”让图像和标题(段落)占据各自的一半 我真的没想到chrome和firefox之间会有任何区别,两者都是非常标准的浏览器。
*{
box-sizing: border-box;
}
nav {
width: 100%;
position: fixed;
display: flex;
box-sizing: border-box;
height: 100px;
background-color: rgb(0, 36, 93);
}
#navOffset {
z-index: -1;
height: 100px;
}
nav a{
/* border: solid white 0.01px; */
padding: 1.5%;
margin: auto;
text-decoration: none;
color: rgb(255, 255, 255);
}
nav a:active{
color: black;
}
nav a:hover{
background-color: #ffffff;
color: rgb(0, 36, 93);;
}
header{
display: flex;
flex-flow: column;
}
header h1{
margin: auto;
flex:1;
margin-bottom: 1%;
margin-top: 2%;
font-weight: 600;
font-size: 300%;
}
header p{
flex:1;
margin: auto;
margin: 1% auto;
font-size: 100%;
}
main{
display: flex;
flex-flow: row wrap;
}
main img{
flex:1;
padding: 2%;
flex: 0 50%;
}
main p, div p{
margin:1%;
padding: 1%;
flex:1;
margin: auto;
flex: 0 50%;
footer{
width: 100%;
padding: 2%;
background-color: rgb(0, 36, 93);
color: white;
display: flex;
}
footer p{
color: white;
margin: auto;
}
/* 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;
}
*{
box-sizing: border-box;
}
nav {
width: 100%;
position: fixed;
display: flex;
box-sizing: border-box;
height: 100px;
background-color: rgb(0, 36, 93);
}
#navOffset {
z-index: -1;
height: 100px;
}
nav a{
/* border: solid white 0.01px; */
padding: 1.5%;
margin: auto;
text-decoration: none;
color: rgb(255, 255, 255);
}
nav a:active{
color: black;
}
nav a:hover{
background-color: #ffffff;
color: rgb(0, 36, 93);;
}
header{
display: flex;
flex-flow: column;
}
header h1{
margin: auto;
flex:1;
margin-bottom: 1%;
margin-top: 2%;
font-weight: 600;
font-size: 300%;
}
header p{
flex:1;
margin: auto;
margin: 1% auto;
font-size: 100%;
}
main{
display: flex;
flex-flow: row wrap;
}
main img{
flex:1;
padding: 2%;
flex: 0 50%;
}
main p, div p{
margin:1%;
padding: 1%;
flex:1;
margin: auto;
flex: 0 50%;
footer{
width: 100%;
padding: 2%;
background-color: rgb(0, 36, 93);
color: white;
display: flex;
}
footer p{
color: white;
margin: auto;
}