1. 论坛系统升级为Xenforo,欢迎大家测试!
    Dismiss Notice

一个CSS初学者的小问题。。路过的兄弟都来瞅下吧~~~~~~~~~

Discussion in '前端开发' started by 风狼, Mar 17, 2006.

  1. 风狼

    风狼 New Member

    Joined:
    Oct 1, 2005
    Messages:
    7,452
    Likes Received:
    25
    我把一张图切成两张图。一张当背景。一张当图像。。我就写成
    CSS:
    -------------------------------------------
    #top1 {
    width:783px;
    height:30;
    background:url(../images/top1.gif);
    text-align:right;
    }
    #top2 {
    width:783px;
    height:34;}
    ======================
    HTML
    -------------------------------------------------
    <!--Header-->
    <div id="header">
    <div id="top1"></div>
    <div id="top2"><img src="images/top2.gif" /></div>
    </div>
    <!--Header End-->
    -------------------------------------------------
    这样。。可上面当背景的却变形了。。好像在top1里写的height值没有起作用。。
     
  2. shangjay

    shangjay New Member

    Joined:
    Jan 13, 2006
    Messages:
    3,530
    Likes Received:
    15
    截个图看看。
     
  3. 风狼

    风狼 New Member

    Joined:
    Oct 1, 2005
    Messages:
    7,452
    Likes Received:
    25
    [​IMG]
    不正常
    [​IMG]
    正常应该是
     
  4. shangjay

    shangjay New Member

    Joined:
    Jan 13, 2006
    Messages:
    3,530
    Likes Received:
    15
    #top1 height: 30

    #top2 height: 34
     
  5. 风狼

    风狼 New Member

    Joined:
    Oct 1, 2005
    Messages:
    7,452
    Likes Received:
    25
    你看我CSS。有写呀。。
     
  6. leeonon

    leeonon New Member

    Joined:
    Mar 10, 2006
    Messages:
    9
    Likes Received:
    0
    #top1{
    display:block;
    }

    加上这个!
     
  7. 风狼

    风狼 New Member

    Joined:
    Oct 1, 2005
    Messages:
    7,452
    Likes Received:
    25
    呀哦。睡一觉醒来发现问题是
    height:30 少了个单位px造成的。。。

    谢过楼上的两位弟兄!!!
     
  8. 西子宜

    西子宜 Well-Known Member

    Joined:
    Sep 5, 2005
    Messages:
    15,739
    Likes Received:
    62
    ............
     
  9. 极品蜗牛

    极品蜗牛 New Member

    Joined:
    Oct 20, 2005
    Messages:
    673
    Likes Received:
    2
    兄弟要注意休息啊
     
  10. ffxk

    ffxk New Member

    Joined:
    Sep 6, 2005
    Messages:
    170
    Likes Received:
    0
    不知道几时我才会CSS了。
     
  11. 老林

    老林 New Member

    Joined:
    Sep 6, 2005
    Messages:
    10,580
    Likes Received:
    36
  12. jeminy

    jeminy Member

    Joined:
    Sep 27, 2005
    Messages:
    975
    Likes Received:
    13
    高深..NND 老林这里也来灌
     
  13. 老林

    老林 New Member

    Joined:
    Sep 6, 2005
    Messages:
    10,580
    Likes Received:
    36
    老林无处不在 阿门
     
  14. redfox

    redfox New Member

    Joined:
    Mar 30, 2006
    Messages:
    106
    Likes Received:
    0
    一般说来还要加一个 line-height:30px;

    如果高度太小了,小于 5px 那最好加一句 font-size:1px;
     
  15. 一路走

    一路走 New Member

    Joined:
    Nov 5, 2005
    Messages:
    2,933
    Likes Received:
    18
    看不懂.阿弥陀佛