0

这个页面的大部分内容都是响应式的,但我唯一想不通的是两个按钮。他们正在使用 javascript 来实现鼠标悬停效果,所以不确定这是否会造成混乱。当您以不同的分辨率查看图像时,我基本上只是希望图像与页面的其余部分一起缩放。

http://74.117.156.152/~pr0digy/

这是html:

<!DOCTYPE html>
<html lang="en">

<head>
        <title>US Legal Support - CapEx</title>
        <meta charset="utf-8" />

        <link rel="stylesheet" href="style.css" type="text/css" />
        <meta name="viewport" content="width-device-width, initial-scale-1.0">

        <script type="text/javascript">
if (document.images) {
    new1 = new Image;
    new2 = new Image;
    existing1 = new Image;
    existing2 = new Image;
    new1.src = "images/new1.png";
    new2.src = "images/new2.png";
    existing1.src = "images/existing1.png";
    existing2.src = "images/existing2.png";
}
function swapImage(thisImage,newImage) {
    if (document.images) {
        document[thisImage].src = eval(newImage + ".src");
    }
}
</script>

</head>

<body class="body">

        <header class="mainHeader">
            <img src="images/uslegalbox.png" alt="usls box" >
        </header>

        <div class="textBox">

            <div class="text">
                    <h1>Capital</h1>
                    <h2>Expenditures</h2>
            </div>

            <div class="buttonsBox">
                <div class="newcapex">
                    <a href="#" onMouseOver="swapImage('new','new2')" onMouseOut="swapImage('new','new1')"><img src="images/new1.png" class="ri" name="new" alt="new capex"></a>
                </div>
                    <div class="capexstatus">
                        <a href="#" onMouseOver="swapImage('existing','existing2')" onMouseOut="swapImage('existing','existing1')"><img src="images/existing1.png" class="ri" name="existing" alt="check status" width="310px" height=$
                    </div>
            </div>

        </div>

</body>

和CSS:

body {
        background: url('images/bg.jpg');
        background-size: 100%;
        background-repeat:no-repeat;
        color: #000305;
        font-size: 87.5%; /* Base font size is 14px */
        font-family: Arial; 'Lucida Sans Unicode';
        text-align: left;
        width: 100%;
        margin: 0;
        padding: 0;
        height: 100%;
}

.mainHeader {
    width: 30%
        height: auto;
        margin: 2% 0 0 -1%;
}

.mainHeader img {
        width: 35%;
        height: 100%;
}

.textBox {
    height: 275px;
        margin-top: 3%;
        background-image: url('images/buttonsbox.png');
        background-repeat: repeat-x;
}

.text {
        width: 40%;
        margin-left: 5%;
        float: left;
        margin-top: -1%;
}

.buttonsBox {
    width: 55%;
        float: right;
        margin-top: 50px;
}

.newcapex {
    float: left;
        border: 0;
        margin-top: 45px;
}

.capexstatus {
    margin-left: 50%;
        border: 0;
        margin-top: 45px;
}

.newcapex img {
        width: 100%;
}

/* Text */

h1 {
        color: #ffffff;
        font-size: 5.0em;
        margin-top: 60px;
}

h2 {
        color: #ffffff;
        font-size: 5.0em;
        margin-top:-30px;
}
4

2 回答 2

0

首先,删除图像的所有绝对尺寸

<div class="buttonsBox">
    <div class="newcapex">              
        <a href="#" onmouseover="swapImage('new','new2')" onmouseout="swapImage('new','new1')">
            <img src="CapEx_arquivos/new1.png" class="ri" name="new" alt="new capex">
        </a>                
    </div>
    <div class="capexstatus">               
        <a href="#" onmouseover="swapImage('existing','existing2')" onmouseout="swapImage('existing','existing1')">
            <img src="CapEx_arquivos/existing1.png" class="ri" name="existing" alt="check status">
        </a>
    </div>
</div>

第二。我将浮动属性设置为资本支出状态,并将两个容器的宽度设置为 40%

.newcapex {
    float: left;
    border: 0;
    margin-top: 45px;
    width: 40%;
}

.capexstatus {
    float: right;
    border: o;
    margin-top: 45px;
    margin-right: 20px;
    width: 40%;
}

第三。我也放了第二张宽度为 100% 的图像。

.newcapex img, .capexstatus img {
    width: 100%;
}
于 2013-08-07T21:14:41.143 回答
0

我看到 .newcapex 按钮在 FF 中正确缩放。

尝试添加 .capexstatus img { width:100%; } 到你的 CSS 中,看看右边的按钮是否也可以缩放。

于 2013-08-07T21:00:25.253 回答