我似乎无法在css中编辑我的图像的宽度和高度

时间:2017-09-07 01:35:00

标签: html css

所以我使用括号编码,我是编程的新手我在图像周围放了一个div元素,所以我可以在css中编辑它,但由于某种原因,宽度和高度没有变化

h1 {
    width: 300px;
    margin:400px auto;
    color: red;
    font-family:Impact ;
}
.character{
    width:45px; 
    height:45px;
}
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="mainc.css">
        <script src="javascript.js"></script>
    </head>
    <body>
        <h1>
            So I am just testing out stuff on here 
        </h1>
        <div class: "character">
        <img src="C:/Users/Nick Malone/Desktop/Downloads/block.jpg">
        </div>
    </body>
</html>

5 个答案:

答案 0 :(得分:1)

<div class: "character">是将一个类分配给div的错误表示法。试试<div class="character">

答案 1 :(得分:1)

您需要更新css以定位图像。见下文。

.character img{
    width:45px; 
    height:45px;
}

答案 2 :(得分:0)

试试这个

. character img{
     width:100px;
     height:100px;
     display:block;
 }

答案 3 :(得分:0)

&#13;
&#13;
h1 {
    width: 300px;
    margin:400px auto;
    color: red;
    font-family:Impact ;
}
img{
    width:45px; 
    height:45px;
}
&#13;
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="mainc.css">
        <script src="javascript.js"></script>
    </head>
    <body>
        <h1>
            So I am just testing out stuff on here 
        </h1>
        <div class= "character">
        <img src="http://imgsv.imaging.nikon.com/lineup/lens/zoom/normalzoom/af-s_dx_18-140mmf_35-56g_ed_vr/img/sample/sample1_l.jpg">
        </div>
    </body>
</html>
&#13;
&#13;
&#13;

答案 4 :(得分:0)

您需要为图像指定宽度和高度而不是div。

 select * from table_name where columnName = ?
h1 {
    width: 300px;
    margin:400px auto;
    color: red;
    font-family:Impact ;
}
#character{
    width:45px; 
    height:45px;
}