trhthong
07-03-2008, 20:24
Tui có đoạn code sau:
#banner {
position: relative;
width: 778px;
margin: 0 auto;
height: 212px;
background: url(imgs/banner.jpg);
}
#banner #topmenu {
position: absolute;
top: 180px; left: 208px;
width: 564px; height: 32px;
background: url(imgs/bgr_topbar1.gif) repeat-x;
}
Trong phần body, tui cho cái #topbanner nằm trong #banner. Tôi có hai vấn đề để hỏi như sau:
1. Nếu trong #topmenu, tui đổi cái top và left thành:
bottom: 0px;
right: 0px;
thì kết quả luôn là cái phần topmenu luôn nằm ở góc trên bên trái, giống như khi đặt: top: 0; và left: 0; ???
Giải thích giùm nghen!
2. Nếu tôi không đặt thuộc tính: position: relative; trong #bannner thì cái #topbanner lại không tài nào ở một vị trí mong muốn được?
Giải thích giùm luôn nghen!
#banner {
position: relative;
width: 778px;
margin: 0 auto;
height: 212px;
background: url(imgs/banner.jpg);
}
#banner #topmenu {
position: absolute;
top: 180px; left: 208px;
width: 564px; height: 32px;
background: url(imgs/bgr_topbar1.gif) repeat-x;
}
Trong phần body, tui cho cái #topbanner nằm trong #banner. Tôi có hai vấn đề để hỏi như sau:
1. Nếu trong #topmenu, tui đổi cái top và left thành:
bottom: 0px;
right: 0px;
thì kết quả luôn là cái phần topmenu luôn nằm ở góc trên bên trái, giống như khi đặt: top: 0; và left: 0; ???
Giải thích giùm nghen!
2. Nếu tôi không đặt thuộc tính: position: relative; trong #bannner thì cái #topbanner lại không tài nào ở một vị trí mong muốn được?
Giải thích giùm luôn nghen!