我使用流体布局通过Dreamweaver制作微型网站。在其中,我将标题和横幅放在div下的表格中,如下所示:
<div id="divHeader">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody>
<tr>
<td style="width: 30px;"></td>
<td style="vertical-align: middle; font-size: 1.3rem; font-weight: bold;">
<p><span>Move Toward </span> <span class="hdr">Zero Unplanned Downtime</span></p>
</td>
</tr>
<tr>
<td colspan="2" style="text-align: center;">
<img src="images/Mining_site_1192x181-12.png" alt=""/>
</td>
</tr>
</tbody>
</table>
</div>
在大多数浏览器中,这种方法效果很好(包括移动浏览器):
不幸的是,在Firefox中,它以这种方式显示:
当我使用内置的Inspect Elemet时,这就是我在Firefox中看到的:
由于某种原因,该表显示在DIV元素之外。该表没有与之关联的CSS类,对于DID,这是其类divHeader的CSS:
#divHeader {
font-family: Arial;
background-color: #F89329;
text-transform: uppercase;
font-size: 1rem;
color: #fff;
line-height: 1rem;
border: none;
}
Firefox中的div中是否存在问题?如果是这样,有什么好的解决方法?
这是我的CSS代码:
@charset "utf-8";
/* Simple fluid media
Note: Fluid media requires that you remove the media's height and width attributes from the HTML
http://www.alistapart.com/articles/fluid-images/
*/
img, object, embed, video {
max-width: 100%;
}
a {
text-decoration: none;
}
a: hover {
color: #F59D51;
text-decoration: none;
}
/* IE 6 does not support max-width so default to width 100% */
.ie6 img {
width:100%;
}
/*
Dreamweaver Fluid Grid Properties
----------------------------------
dw-num-cols-mobile: 4;
dw-num-cols-tablet: 8;
dw-num-cols-desktop: 12;
dw-gutter-percentage: 25;
Inspiration from "Responsive Web Design" by Ethan Marcotte
http://www.alistapart.com/articles/responsive-web-design
and Golden Grid System by Joni Korpi
http://goldengridsystem.com/
*/
.fluid {
clear: both;
margin-left: 0;
width: 100%;
float: left;
display: block;
}
.fluidList {
list-style:none;
list-style-image:none;
margin:0;
padding:0;
}
/* Mobile Layout: 480px and below. */
.gridContainer {
margin-left: auto;
margin-right: auto;
width: 86.45%;
padding-left: 0.75%;
padding-right: 0.75%;
margin: auto;
clear: none;
float: none;
background-color: #fff;
}
.zeroMargin_mobile {
margin-left: 0;
}
.hide_mobile {
display: none;
}
#divEPMLogo {
background-color:#fff;
}
#divHeader {
font-family: Arial;
background-color: #F89329;
text-transform: uppercase;
font-size: 1rem;
color: #fff;
line-height: 1rem;
border: none;
}
#divHeader td.tdBanner {
background-image: url(../images/Mining_site_v2_Banner480.png);
background-position: bottom;
background-repeat: no-repeat;
background-size: contain;
height: 181px;
max-width: 480px;
margin: 0px;
}
#divSubheader {
font-family: Arial;
background-color: #fff;
text-transform: uppercase;
font-size: 1rem;
color: #4D4F44;
line-height: 1.3rem;
border: none;
}
div.divCnt {
width: 100%;
border: none;
}
#content header {
font-size: 1.1rem;
font-weight: bold;
color: #4D4F44;
font-family: Arial;
}
#content article {
font-size: 1rem;
color: #818183;
font-family: Arial;
}
#content hr {
width: 100%;
height: 3px;
color: #FFD022;
background-color: #FFD022;
border: none;
margin-top: 0px;
}
div.divBack {
width: 100%;
text-align: center;
}
div.divBack a {
color: #818183;
font-size: 0.9rem;
font-family: Arial;
text-decoration: none;
}
div.divBack a:hover {
color: #F89329;
text-decoration: none;
}
div.divRMBtn {
color: #fff;
background-color: #F89329;
text-align: center;
font-size: 0.9rem;
width: 6rem;
padding: 3px 0px;
font-family: Arial;
}
div.divRMBtn a {
color: #fff;
text-decoration: none;
}
div.divRMBtn a:hover {
color: #fff;
text-decoration: none;
}
div.divSecFt {
font-size: 0.8rem;
font-style: italic;
font-family: Arial;
padding: 10px 0px;
}
div.divSecFt a {
color: #4D4F44;
text-decoration: none;
}
div.divSecFt a:hover {
color: #F89329;
text-decoration: none;
}
div.container1 {
display:table-cell;
vertical-align: middle;
border: 1px solid black;
/*padding: 0px 0px 0px 30px;*/
position: relative;
left: 30px;
}
div.divForm {
font-family:Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1rem;
text-align: left; width:50%;
height: 26rem;
min-width: 320px;
margin: 0 auto;
color:#4B4B4B;
border: none;
}
span.hdr {
color: #4D4F44;
text-wrap: none;
}
span.hdr2 {
color: #F59D51;
text-transform: uppercase;
font-size: 1.1rem;
font-weight: bold;
}
td.td-ico {
width: 73px;
max-width: 73px;
min-width: 73px;
text-align: center;
vertical-align: top;
padding-right: 5px;
}
.ulNltr{
color: #4D4F44;
font-family: Arial;
font-size: 0.9rem;
line-height: 1rem;
margin-left: 0px;
padding-left: 15px;
}
.ulNltr li {
padding-bottom: 10px;
list-style-image:url(../images/icons/bullet.png)
}
.ulNltr li.q1 {
list-style-image:url(../images/icons/question_icon.jpg)
}
.ulNltr li.c1 {
list-style-image:url(../images/icons/contact_icon.jpg)
}
.ulNltr a {
color: #4D4F44;
text-decoration: none;
}
.ulNltr a:hover {
color: #F89329;
text-decoration: none;
}
/* Tablet Layout: 481px to 768px. Inherits styles from: Mobile Layout. */
@media only screen and (min-width: 481px) {
.gridContainer {
margin-left: auto;
margin-right: auto;
width: 90.675%; /*width: 480px;*/
padding-left: 0.75%;
padding-right: 0.75%;
margin: auto;
clear: none;
float: none;
background-color: #fff;
}
.zeroMargin_tablet {
margin-left: 0;
}
.hide_tablet {
display: none;
}
#divEPMLogo {
background-color:#fff;
}
#divHeader {
font-family: Arial;
background-color: #F89329;
text-transform: uppercase;
font-size: 1rem;
color: #fff;
line-height: 1rem;
border: none;
}
#divHeader td.tdBanner {
background-image: url(../images/Mining_site_v2_Banner768.png);
background-position: bottom;
background-repeat: no-repeat;
background-size: contain;
height: 181px;
max-width: 480px;
margin: 0px;
}
#divSubheader {
font-family: Arial;
background-color: #fff;
text-transform: uppercase;
font-size: 1rem;
color: #4D4F44;
line-height: 1.3rem;
border: none;
}
div.divCnt {
width: 100%;
border: none;
}
#content header {
font-size: 1.1rem;
font-weight: bold;
color: #4D4F44;
font-family: Arial;
}
#content article {
font-size: 1rem;
color: #818183;
font-family: Arial;
}
#content hr {
width: 100%;
height: 3px;
color: #FFD022;
background-color: #FFD022;
border: none;
margin-top: 0px;
}
div.divBack {
width: 100%;
text-align: center;
}
div.divBack a {
color: #818183;
font-size: 0.9rem;
font-family: Arial;
text-decoration: none;
}
div.divBack a:hover {
color: #F89329;
text-decoration: none;
}
div.divRMBtn {
color: #fff;
background-color: #F89329;
text-align: center;
font-size: 0.9rem;
width: 6rem;
padding: 3px 0px;
font-family: Arial;
}
div.divRMBtn a {
color: #fff;
text-decoration: none;
}
div.divRMBtn a:hover {
color: #fff;
text-decoration: none;
}
div.divSecFt {
font-size: 0.8rem;
font-style: italic;
font-family: Arial;
padding: 10px 0px;
}
div.divSecFt a {
color: #4D4F44;
text-decoration: none;
}
div.divSecFt a:hover {
color: #F89329;
text-decoration: none;
}
div.container1 {
display:table-cell;
vertical-align: middle;
border: 1px solid black;
/*padding: 0px 0px 0px 30px;*/
position: relative;
left: 30px;
}
div.divForm {
font-family:Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1rem;
text-align: left; width:50%;
height: 26rem;
min-width: 320px;
margin: 0 auto;
color:#4B4B4B;
border: none;
}
span.hdr {
color: #4D4F44;
text-wrap: none;
}
span.hdr2 {
color: #F59D51;
text-transform: uppercase;
font-size: 1.1rem;
font-weight: bold;
}
td.td-ico {
width: 73px;
max-width: 73px;
min-width: 73px;
text-align: center;
vertical-align: top;
padding-right: 5px;
}
.ulNltr{
color: #4D4F44;
font-family: Arial;
font-size: 0.8rem;
line-height: 1rem;
}
.ulNltr li {
padding-bottom: 10px;
list-style-image:url(../images/icons/bullet.png)
}
.ulNltr a {
color: #4D4F44;
text-decoration: none;
}
.ulNltr a:hover {
color: #F89329;
text-decoration: none;
}
}
/* Desktop Layout: 769px to a max of 1079px. Inherits styles from: Mobile Layout and Tablet Layout. */
@media only screen and (min-width: 769px) {
.gridContainer {
width: 88.5%; /*width: 768px;*/
max-width: 768px;
padding-left: 0.75%;
padding-right: 0.75%;
margin: auto;
clear: none;
float: none;
margin-left: auto;
margin-right: auto;
background-color: #fff;
}
.zeroMargin_desktop {
margin-left: 0;
}
.hide_desktop {
display: none;
}
#divEPMLogo {
background-color:#fff;
}
#divHeader {
font-family: Arial;
background-color: #F89329;
text-transform: uppercase;
font-size: 1rem;
color: #fff;
line-height: 1rem;
border: none;
}
#divHeader td.tdBanner {
background-image: url(../images/Mining_site_v2_Banner768.png);
background-position: center;
background-repeat: no-repeat;
background-size: contain;
height: 181px;
max-width: 768px;
margin: 0px;
}
#divSubheader {
font-family: Arial;
background-color: #fff;
text-transform: uppercase;
font-size: 1rem;
color: #4D4F44;
line-height: 1.3rem;
border: none;
}
div.divCnt {
width: 33%;
float: left;
border: none;
}
#content header {
font-size: 1.1rem;
font-weight: bold;
color: #4D4F44;
font-family: Arial;
}
#content article {
font-size: 1rem;
color: #818183;
font-family: Arial;
}
#content hr {
width: 100%;
height: 3px;
color: #FFD022;
background-color: #FFD022;
border: none;
margin-top: 0px;
}
div.cntRw {
display: table-cell;
}
div.divBack {
width: 100%;
text-align: center;
}
div.divBack a {
color: #818183;
font-size: 0.9rem;
font-family: Arial;
text-decoration: none;
}
div.divBack a:hover {
color: #F89329;
text-decoration: none;
}
div.divRMBtn {
color: #fff;
background-color: #F89329;
text-align: center;
font-size: 0.9rem;
width: 6rem;
padding: 3px 0px;
font-family: Arial;
}
div.divRMBtn a {
color: #fff;
text-decoration: none;
}
div.divRMBtn a:hover {
color: #fff;
text-decoration: none;
}
div.divSecFt {
font-size: 0.8rem;
font-style: italic;
font-family: Arial;
padding: 10px 0px;
}
div.divSecFt a {
color: #4D4F44;
text-decoration: none;
}
div.divSecFt a:hover {
color: #F89329;
text-decoration: none;
}
div.container1 {
display:table-cell;
vertical-align: middle;
border: 1px solid black;
/*padding: 0px 0px 0px 30px;*/
position: relative;
left: 30px;
}
div.divForm {
font-family:Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1rem;
text-align: left; width:50%;
height: 26rem;
min-width: 320px;
margin: 0 auto;
color:#4B4B4B;
border: none;
}
span.hdr {
color: #4D4F44;
text-wrap: none;
}
span.hdr2 {
color: #F59D51;
text-transform: uppercase;
font-size: 1.1rem;
font-weight: bold;
}
td.td-ico {
width: 73px;
max-width: 73px;
min-width: 73px;
text-align: center;
vertical-align: top;
padding-right: 5px;
}
.ulNltr{
color: #4D4F44;
font-family: Arial;
font-size: 0.8rem;
line-height: 1rem;
}
.ulNltr li {
padding-bottom: 10px;
list-style-image:url(../images/icons/bullet.png)
}
.ulNltr a {
color: #4D4F44;
text-decoration: none;
}
.ulNltr a:hover {
color: #F89329;
text-decoration: none;
}
}
/* Desktop Layout: 1080p and beyond. Inherits styles from: Mobile Layout and Tablet Layout. */
@media only screen and (min-width: 1079px) {
.gridContainer {
width: 88.5%; /*width: 1192px; */
max-width: 1192px;
padding-left: 0.75%;
padding-right: 0.75%;
margin: auto;
clear: none;
float: none;
margin-left: auto;
margin-right: auto;
background-color: #fff;
}
.zeroMargin_desktop {
margin-left: 0;
}
.hide_desktop {
display: none;
}
#divEPMLogo {
background-color:#fff;
}
#divHeader {
font-family: Arial;
background-color: #F89329;
text-transform: uppercase;
font-size: 1rem;
color: #fff;
line-height: 1rem;
border: none;
clear: right;
}
#divHeader td.tdBanner {
background-image: url(../images/Mining_site_1192x181-12.png);
background-position: center;
background-repeat: no-repeat;
background-size: contain;
height: 181px;
max-width: 1191px;
margin: 0px;
}
#divSubheader {
font-family: Arial;
background-color: #fff;
text-transform: uppercase;
font-size: 1rem;
color: #4D4F44;
line-height: 1.3rem;
border: none;
}
div.divCnt {
width: 33%;
float: left;
border: none;
}
#content header {
font-size: 1.1rem;
font-weight: bold;
color: #4D4F44;
font-family: Arial;
}
#content article {
font-size: 1rem;
color: #818183;
font-family: Arial;
}
#content hr {
width: 100%;
height: 3px;
color: #FFD022;
background-color: #FFD022;
border: none;
margin-top: 0px;
}
div.cntRw {
display: table-cell;
}
div.divBack {
width: 100%;
text-align: center;
margin: 0px;
}
div.divBack a {
color: #818183;
font-size: 0.9rem;
font-family: Arial;
text-decoration: none;
}
div.divBack a:hover {
color: #F89329;
text-decoration: none;
}
div.divRM {
color: #818183;
font-size: 0.9rem;
font-family: Arial;
}
div.divRMBtn {
color: #fff;
background-color: #F89329;
text-align: center;
font-size: 0.9rem;
width: 6rem;
padding: 3px 0px;
font-family: Arial;
}
div.divRMBtn a {
color: #fff;
text-decoration: none;
}
div.divRMBtn a:hover {
color: #fff;
text-decoration: none;
}
div.divSecFt {
font-size: 0.8rem;
font-style: italic;
font-family: Arial;
padding: 10px 0px;
}
div.divSecFt a {
color: #4D4F44;
text-decoration: none;
}
div.divSecFt a:hover {
color: #F89329;
text-decoration: none;
}
div.container1 {
display:table-cell;
vertical-align: middle;
border: 1px solid black;
/*padding: 0px 0px 0px 30px;*/
position: relative;
left: 30px;
}
div.divForm {
font-family:Gotham, 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 1rem;
text-align: left; width:50%;
height: 26rem;
min-width: 320px;
margin: 0 auto;
color:#4B4B4B;
border: none;
}
span.hdr {
color: #4D4F44;
text-wrap: none;
}
span.hdr2 {
color: #F59D51;
text-transform: uppercase;
font-size: 1.1rem;
font-weight: bold;
}
td.td-ico {
width: 73px;
max-width: 73px;
min-width: 73px;
text-align: center;
vertical-align: top;
padding-right: 5px;
}
.ulNltr{
color: #4D4F44;
font-family: Arial;
font-size: 0.8rem;
line-height: 1rem;
}
.ulNltr li {
padding-bottom: 10px;
list-style-image:url(../images/icons/bullet.png)
}
.ulNltr a {
color: #4D4F44;
text-decoration: none;
}
.ulNltr a:hover {
color: #F89329;
text-decoration: none;
}
}
答案 0 :(得分:0)
似乎Firefox在div中遇到问题。我将HTML部分更改为:
<!-- Page header and banner -->
<div id="divHeader">
<div style="display: table-cell; vertical-align: middle;">
<p>Move Toward <span class="hdr">Zero Unplanned Downtime</span></p>
</div>
</div>
<div id="divHBanner">
<img src="images/Mining_site_1192x181-12.png" alt=""/>
</div>
<!-- End Page header and banner -->
&#13;
它修复了原始错误,但它打开了另一个错误。我将为此发布一个单独的问题。
答案 1 :(得分:0)
我已经尝试过jsfiddle和我的网页测试页面,当我删除@charset"utf-8";
当我再次设置时,它再次相撞