2011-03-06 7 views
0

나는 나의 클라이언트를위한 사이트에서 일하고있다. 문제는 내가 바꿀 때마다 네비게이션 바의 버튼들이 모두 뭉친다는 것이다. 이 문제의 원인은 분명하지 않기 때문에 여기에 도움을 청했습니다. 또한 브라우저 창이 최대화 될 때 navi 바가 멋지게 보이지만 내 고객은 페이지 중간에 트위터 버튼이 표시됩니다. 그녀의 화면이 내 것보다 작기 때문에 해상도 문제라고 생각하지만 해결 방법이 있습니까?CSS/HTML 네비게이션 바 문제

웹 사이트 :
the crue cart

HTML

<title>the crue cart</title> 

    <link rel="shortcut icon" href="images/favicon.png"> 
    <link rel="alternate" type="application/rss+xml" href="{RSS}"> 
    <link rel="stylesheet" href="style.css" type="text/css" media="screen" /> 
    <script src="http://platform.twitter.com/anywhere.js?id=yQDKaggXesWYWPCPFNXn1Q&amp;v=1"> 
    </script> 
    <script type="text/javascript"> 
     twttr.anywhere(function(twitter) { 
      twitter.hovercards(); 
     }); 
    </script> 



</head> 
<body> 

    <div id="container"> 

     <div id="header"> 
      <ul> 
       <li><div id="logo"> 
        <h1 class="thecruecart">the crue cart 
        <img src="images/leaf.png" width="15" height="15" class="leaf"></h1> 
        <h1 class="wholesnackerie">whole snackerie<h1> 
       </div></li> 
       <!--Who What When Where Why Help!--> 
       <li class="navigation"><a href="home.html" class="navigation">Who<span class="green">?</span></a></li> 
       <li class="navigation"><a href="thewhat.html" class="navigation">What<span class="green">?</span></a></li> 
       <li class="navigation"><a href="thewhenwhere.html" class="navigation">When & Where<span class="green">?</span></a></li> 
       <li class="navigation"><a href="thewhy.html" class="navigation">Why<span class="green">?</span></a></li> 
       <li class="navigation"><a href="help.html" class="navigation">Help<span class="green">!</span></a></li> 
       <li class="navigation"><a href="order.html" class="navigation">ORDER<span class="green">!</span></a></li> 
       <li class="navigation"><div id="share"> 
       <iframe src="http://www.facebook.com/plugins/like.php?href=facebook.com%2Fthecruecart&amp;layout=button_count&amp;show_faces=true&amp;width=450&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:75px; height:21px;" allowTransparency="true"></iframe> 
       <a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.twitter.com/thecruecart" data-text="Check out The Crue Cart!" data-count="horizontal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> 
       </div></li> 
      </ul> 
     </div> 

     <div id="navbar"></div> 

     <div id="title"> 
      <h2 class="title">Catering? Hungry?</h2> 
     </div> 

     <div id="body"> 
      <p>The Crue Cart is a mobile bakery that finds its home in Bellevue. We love animals and nutrition, and our cupcakes show that.<br/> No wheat, no animal products (or by-products) and no processed sugar. Also, our products will be organic and locally produced<br/> whenever possible. We love supporting local agriculture and economy.</p> 
      <br/> 
      <p>Want to chat? <span class="chunky">Email us: [email protected]</span></p> 
     </div> 

     <div class="clearfooter"></div> 
    </div> 

    <div id="footer"> 
     <p class="ft">&copy the crue cart 2010. All Rights Reserved.</p> 
    </div>  
</body> 

CSS

@font-face { font-family: chunkfive; src: url("fonts/Chunkfive.otf") format("opentype"); }

 @font-face { 
    font-family: aller; 
    src: url("fonts/aller.ttf") format("truetype"); 
    } 

    @font-face { 
    font-family: tgheros; 
    src: url("fonts/tgheros.otf") format("opentype"); 
    } 

    @font-face { 
    font-family: tgheros-bold; 
    src: url("fonts/tgheros-bold.otf") format("opentype"); 
    } 

    html {} 

    body { 
      width:auto; 
      height:100%; 

      background-color:#ffffff; 
      margin:0px; 
      margin-left:auto; 
      margin-right:auto; 
      padding:0px; 
    } 

    h1, h2, h3, h4, h5, h6 { 
     font-family:chunkfive; 
     color:#0000ff; 
     margin:0px; 
    } 

    h1 { 
     font-family:chunkfive; 
     color:#0000ff; 
     font-size:30px; 
     margin:0px; 
     padding:0px; 
    } 

    h1.thecruecart { 
     font-family:chunkfive; 
     color:#0000ff; 
     font-size:30px; 
     margin-left:auto; 
    } 

    h1.wholesnackerie { 
     font-family:chunkfive; 
     color:#44aa00; 
     font-size:15px; 
     margin-left:40px; 
    } 

    h2.title { 
     font-size:35px; 
     margin-top:10px; 
     margin-left:10px; 
    } 

    h2 a{ 
     font-size:35px; 
     color:#44aa00; 
     margin-top:10px; 
     margin-left:10px; 
    } 

    img { 
     margin:0px; 
    } 

    img.leaf { 
     position:relative; 
     top:2px; 
     left:-8px; 
    } 

    p { 
     font-family:tgheros-bold; 
     font-size:18px; 
     color:#0000ff; 
     margin:0px; 
     margin-left:10px; 
    } 

    p.order{ 
     font-family:tgheros-bold; 
     font-size:16px; 
     color:#0000ff; 
     margin:0px; 
     margin-left:10px; 
    } 

    p.facebook { 
     display:inline; 
     font-family:tgheros-bold; 
     font-size:18px; 
     color:#0000ff; 
     margin:0px; 
     margin-left:5px; 
    } 

    p.ft { 
     color:#0000ff; 
     font-family:chunkfive; 
     font-size:14px; 
     letter-spacing:1px; 

     margin:0px; 
     padding:0px; 
    } 

    a { 
     color:#44aa00; 
     font-family:chunkfive; 
     font-size:20px; 
     letter-spacing:1px; 
     text-decoration:none; 
     margin:0px; 
     padding:0px; 
    } 

    a:link, a:visited, a:hover, a:active { 

    } 

    a.navigation { 
     color:#0000ff; 
     font-family:chunkfive; 
     font-size:20px; 
     text-decoration:none; 
    } 

    ul { 
     list-style-type:none; 
     margin:0px; 
     padding:0px; 
    } 

    li { 
     float:left; 
    } 

    li.navigation{ 
     display:inline; 
     position:relative; 
     top:33px; 
     float:left; 
     margin-left:45px; 
    } 

    iframe { 
     display:inline; 
     margin-top:0px; 
     margin-left:10px; 
    } 

    /*Facebook Stuffs*/ 

    /*Twitter Stuffs*/ 

    .chunky { 
     color:#44aa00; 
     font-family:chunkfive; 
     font-size:20px; 
     letter-spacing:1px; 
     margin:0px; 
     padding:0px; 
    } 

    .green { 
     color:#44aa00; 
    } 

    .clearfooter { 
     height:1px; 
     clear:both; 
    } 

    #container { 
     min-height:100%; 
     margin-bottom: -20px; 
     position: relative; 
    } 

    #header { 
     display:block; 
     width:auto; 
     height:58px; 
     padding-right:5px; 
     padding-left:5px; 
    } 

    #logo { 
     margin-top:0px; 
     margin-left:10px; 
    } 

    #navbar { 
     display:block; 
     width:auto; 
     height:2px; 
     background-color:#0000ff; 
    } 

    #share { 
     display:inline; 
     margin:0px; 
    } 

    #body { 
     width:1330px; 
     margin:0px; 
     margin-bottom:30px; 
     padding:0px; 
    } 

    #footer { 
     display:block; 
     width:auto; 
     height:10px;    
     position:realtive;   
     text-align:center; 
     clear:both; 
    }</code> 

답변

1

Problem is, is that you don't have a fixed width container you have width:100%, the site is liquid.

You need to set a width on a container and it will play nice!

0

You have set the body width to 1330px. If you are really making a site for a client, you might be better of going with the "standard" maximum width of 960px. That way the site will work properly on most screen sizes.

Some reading that sides the magic number: http://cameronmoll.com/archives/2009/04/is_it_time_to_move_beyond_960/

ps. You should not set the width to the body element itself, some older browsers are quite quirky with it, I think at least IE6 does not understand it, but cannot check now since I'm don't have it close to hand.

0

I don't think you have posted all the CSS styles in your question. Nevertheless, you have to fix the width of the navigation bar element in css. You could use a fixed width for your header div, but I'd use another div or ul for the navigation items and use fixed width on those, so that the rest of the items in the header can still float around.

0

You don't have a doctype and are in quirks mode. Add this to your first line and see where we stand: <!doctype html>

0

이 탐색 스타일링 꽤 몇 가지 방법이 있고, 나는 방법을 보여 레이아웃에 변화를 만들어 당신은 그것에 접근 할 수 있습니다.

내 변형을 http://jsfiddle.net/audetwebdesign/YzrUn/에서 확인하고 다음 의견과 설명을 참조하십시오.

CSS 스타일링

당신은 CSS 선택기를 활용할 수있어 스타일 시트를 간소화, 불필요한 클래스를 제거.

로고는 header에 별도의 div으로 유지하고 ul 목록을 사용하여 탐색 링크를 마크 업합니다.

로고를 인쇄하거나 이미지를 사용할 수 있습니다. logo div를 고정하면 약간의 도움이됩니다. 높이를 auto으로 설정하거나 이미지를 사용하는 경우 고정시킬 수 있습니다.

로고 div를 왼쪽으로 떠서 어떻게이 모든 것이 잘되는지보십시오.

시각적 구분 기호로 사용되는 header에 파란색 테두리를 추가하십시오.

탄력 탐색 바

는 로고 사업부를 삭제하도록 'UL'목록의 여백을 설정합니다. 로고가 떠 다니므로 왼쪽으로 여백이 필요합니다. 그렇지 않으면 링크가 로고 위에 겹쳐집니다.

왼쪽에 li 개의 요소를 띄우고 여백을 추가 한 다음 a 탐색 링크를 block으로 표시하고 패딩을 추가합니다.

b을 사용하여 span + class보다 간단한 녹색 구두점을 추가하는 방법에 유의하십시오.

마지막으로 li 요소에 클래스를 추가하여 iframe 및 소셜 미디어 사이트와 관련된 기타 비트 스타일을 지정할 수 있습니다. 이 내 데모에서

이용 방법

, 당신은 출력 윈도우의 폭을 변화 할 수있다.

창을 좁게 만들면 소셜 미디어 비트를 포함하는 링크가 로고 오른쪽으로 줄 것이고 머리글 패널이 세로로 확장되어 모든 링크에 작은 화면이나 좁은 브라우저 창을 선호하는 사람들.

이렇게하면 다른 이유가없는 한 페이지 너비를 고칠 필요가 없습니다.

다양한 요소에서 패딩을 조정하여 필요한 수직 정렬을 얻을 수 있습니다. 나는 당신의 디자인에 어떤 우발적 인 사건도 돌볼 수있는 충분한 조정 가능한 요소가 여기에 있다고 생각한다.

마지막으로 최상의 결과를 위해 은 엄격한 doctype을 사용합니다. 그렇지 않으면 IE의 단점 모드로 인해 문제가 발생할 수 있습니다.

관련 문제