下面我发布了我的CSS和HTML,我特意试图在调整页面大小时阻止文本和图像移动。目前,如果您运行代码段,您将看到窗口是否已调整大小,然后您就可以看到图像/文本正在移动。关于如何有效地解决这个问题的任何想法?尽管窗口调整大小,我仍希望严格定位。
var myNum = 10;
var data = {};
data["myNum"] = Number(myNum);
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
body {
line-height:1;
}
article,aside,details,figcaption,figure,
footer,header,hgroup,menu,nav,section {
display:block;
}
nav ul {
list-style:none;
}
blockquote, q {
quotes:none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content:'';
content:none;
}
a {
margin:0;
padding:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}
/* change colours to suit your needs */
ins {
background-color:#ff9;
color:#000;
text-decoration:none;
}
/* change colours to suit your needs */
mark {
background-color:#ff9;
color:#000;
font-style:italic;
font-weight:bold;
}
del {
text-decoration: line-through;
}
abbr[title], dfn[title] {
border-bottom:1px dotted;
cursor:help;
}
table {
border-collapse:collapse;
border-spacing:0;
}
/* change border colour to suit your needs */
hr {
display:block;
height:1px;
border:0;
border-top:1px solid #cccccc;
margin:1em 0;
padding:0;
}
input, select {
vertical-align:middle;
}
/******* RESET FINISHED BEYOND THIS POINT ******/
#header{
background-color:#2098D1;
color:white;
padding-top:30px;
}
.group-wrapper{
width:60%;
margin:0 auto;
overflow:hidden;
position:relative;
}
.logo-name{
line-height:1.4;
display:inline-block;
vertical-align: middle;
font-family:arial;
position:relative;
float:left;
}
.logo-name h1{
font-size:20px;
text-transform: uppercase;
}
.logo-name h2{
font-size:15px;
font-weight:normal;
}
#nav{
float:right;
}
#nav ul{
float:right;
width:100%;
font-family:arial;
}
#nav ul li{
display:inline-block;
margin-right:10px;
font-size: 15px;
}
.intro-company{
background-color:#2098D1;
color:white;
padding-top:30px;
height:250px;
}
.group-center{
width: 60%;
margin:0 auto;
position:relative;
text-align:center;
margin-top:30px;
}
.group-center h1{
font-size:48px;
font-family:arial;
}
.group-center h2{
font-family:arial;
font-weight:normal;
font-size:23px;
margin-top:20px;
}
.group-center h3{
font-family:arial;
font-weight:bold;
font-size:13px;
margin-top:30px;
}
.content-wrapper{
width:70%;
margin:0 auto;
}
.main-content h1{
text-align:center;
font-family:Arial;
font-size:50px;
}
.main-content span{
font-weight: bold;
color:#2098D1;
}
.content-wrapper{
overflow:hidden;
margin-top:50px;
}
.content-wrapper img{
float:left;
width:25%;
}
.main-content{
overflow:hidden;
}
.content-wrapper p{
margin-top:20px;
width:75%;
margin-left:25%;
line-height: 1.3em;
font-family:arial;
text-align:center;
font-size:20px;
}
/****** MEDIA QUERIES ******/
@media screen and (min-width:1200px)
and (max-width:1600px){
.main-content h1{
text-align:center;
font-family:Arial;
font-size:35px;
}
.content-wrapper p{
margin-top:20px;
width:75%;
margin-left:25%;
line-height: 1.3em;
font-family:arial;
text-align:center;
font-size:19px;
}
}
/****** SCREEN: 1115PX ******/
@media screen and (max-width: 1115px) {
#nav{
float:none;
}
#nav ul{
float:none;
}
#nav ul li{
display:inline-block;
margin-right:10px;
font-size: 10px;
}
.group-wrapper{
width:70%;
margin:0 auto;
text-align:center;
position:relative;
}
.group-center h1{
font-size:45px;
font-family:arial;
}
.group-center h2{
font-family:arial;
font-weight:normal;
font-size:22.5px;
margin-top:18px;
}
.group-center h3{
font-family:arial;
font-weight:bold;
font-size:13.5px;
margin-top:27px;
}
.logo-name{
display:none;
}
}
/****** SCREEN: 1115PX ******/
@media screen and (max-width: 705px) {
.group-center h1{
font-size:40px;
font-family:arial;
}
.group-center h2{
font-family:arial;
font-weight:normal;
font-size:19.5px;
margin-top:18px;
}
.group-center h3{
font-family:arial;
font-weight:bold;
font-size:11px;
margin-top:27px;
}
.logo-name{
display:none;
}
}
/****** SCREEN: 1115PX ******/
@media screen and (max-width: 609px) {
.group-center h1{
font-size:35px;
font-family:arial;
}
.group-center h2{
font-family:arial;
font-weight:normal;
font-size:16.5px;
margin-top:18px;
}
.group-center h3{
font-family:arial;
font-weight:bold;
font-size:9px;
margin-top:27px;
}
.logo-name{
display:none;
}
}
/****** SCREEN: 1115PX ******/
@media screen and (max-width: 609px) {
.group-center h1{
font-size:30px;
font-family:arial;
}
.group-center h2{
font-family:arial;
font-weight:normal;
font-size:13.5px;
margin-top:18px;
}
.group-center h3{
font-family:arial;
font-weight:bold;
font-size:7px;
margin-top:27px;
}
.logo-name{
display:none;
}
}