我想知道如何在我的CSS中排列元素的位置,如顶部,左侧,对齐等等?看看我的代码根据屏幕大小在CSS中安排元素
<!DOCTYPE html>
<html>
<head>
<title>Avril Lavigne</title>
<link rel = "stylesheet" type = "text/css" href="style/style.css"
</head>
<body>
<div id = "container">
<div id="banner"><img src = "images/banner.jpg"/></div>
<div id = "content">
<div id = "about">
<h1>About Avril Lavigne</h1>
<p>
Avril Ramona Lavigne is a Canadian singer-songwriter.
She was born in Belleville, Ontario, but spent most of her youth in the small
town of Napanee. By the age of 15, she had appeared on stage with Shania Twain; by 16,
she had signed a two-album recording contract with Arista Records worth more than $2 million.
In 2002, when she was 17 years old, Lavigne broke onto the music scene with her debut album Let Go.
</p>
</div>
<div id ="tourdates">
<h2> Tour dates</h2>
</div>
</div>
</div>
</body>
<html>
我的CSS
body{
background-color:#292929;
font-size:small;
}
#container{
padding: 420px;
margin:120px;
border: 5px dotted pink;
}
#banner{
top: 150px;
left: 450px;
right:450px;
position:absolute;
}
#about{
font-size: 100%;
font-family: tahoma;
color: #8B3A62;
position:absolute;
top:320px;
left: 440px;
padding: 20px;
width:320px;
length: 120px;
margin:10px;
border: dashed 2px white;
}
#tourdates{
color: #8B3A62;
padding: 20px;
top:320px;
right: 540px;
position:absolute;
border: dotted 2px white
}
的横幅suposed是在中间的中心,以及约1/4应或它的左上角(上左下横幅)。如何根据用户屏幕设置顶部,左侧和侧面的大小?这里
我的问题是,当我在我的工作空间(我的其他的房子),他们都很好地对准,但是当我去我的笔记本电脑继续我的工作,他们的定位改变。(我的笔记本电脑有一个小屏幕)
我给你那里是更先进一点,我用它当我改变了我的网页的样子,取决于它是否在浏览器或手机,iPad的开上了答案等等 – iblazevic 2012-02-01 19:12:50