2012-09-16 2 views
0

을 맞 춥니 다 (그림에서 볼 수) CSS로 스타일 <td><a href> 년대는 기본적으로 있습니다 buttons of the headerHTML - 내 웹 사이트에 대한 헤더가 테이블 열 권리

. 이제 내 질문은 같은 행에 하나 이상의 버튼을 추가하고 오른쪽에 정렬하려는 경우 어떻게해야합니까?

CSS 솔루션 일 필요는 없습니다. html의 <table> 또는 <td> 태그에서이 작업을 수행 할 방법을 찾고 있습니다.

감사합니다.

편집 :이 헤더 생성 PHP의 일부입니다

echo<<<TOPBARHEREDOC2 
<link rel="stylesheet" href="/css/horizontal_navbar.css" type="text/css" media="screen"> 
<table border="auto" id="topbar" >   
    <td><a class="topbarlink" href="index.php">Ana Sayfa</a></td> 
    <td><a class="topbarlink" href="userstats.php?category=$category">İstatistik</a></td> 
    <td><a class="topbarlink" href="contact.php">İletişim</a></td> 
    <td><a class="topbarlink" href="useful_links.php">Linkler</a></td> 
    <td><a class="topbarlink" href=$lastlink_address>$lastlink_name</a></td> 
</table> 
<hr> 
<br> 
TOPBARHEREDOC2; 

을 그리고 이것은 CSS이다, 당신은 정말 아무것도에 대한 테이블을 사용해서는 안 모든

table a.topbarlink{ 
/*TOP, RIGHT, BOTTOM, & LEFT*/ 
margin:0px 0px 0px 0px; 
font-family: Futura, "Trebuchet MS", Arial, sans-serif; 
font-weight:bold; 
color:#069; 
background-color: #f2f2f2; 
text-decoration: none;  
    border-bottom: 2px solid #ccc; 
    border-top: 2px #ccc; 
    border-right: 2px solid #ccc; 
    border-left: 2px #ccc; 
    /*padding (ordered)*/ 
    padding-top:0.2em; 
    padding-right: 1em; 
    padding-bottom:0.2em; 
    padding-left: 1em; 

} 
+0

예를 들어 jsfiddle.net에 몇 가지 코드를 제공해 주시겠습니까? –

+0

아니, 간단한 HTML (PHP로 생성) 및 CSS. 질문에 코드를 추가하십시오. – void

답변

3

우선 표 형식의 데이터가 아닙니다. 시맨틱 마크 업은 언제나 더 좋기 때문에 메뉴에 번호가없는 목록을 사용하는 것이 더 나을 것입니다.

<table> 
    <tr> 
    <th><a href="#">Item 1</a></th> 
    <th><a href="#">Item 2</a></th> 
    <th><a href="#">Item 3</a></th> 
    <th class="right"><a href="#">Item 4</a></th> 
    </tr> 
</table> 

그런 다음 오른쪽에 하나 개의 항목을 정렬하기 위해 CSS를 사용할 수 있습니다 :

어쨌든

,의는이 테이블라고하자

table { width: 100%; } 
th { float: left; } 
th.right { float: right; }​ 

http://fiddle.jshell.net/6z97w/

+0

+1보다 나은 대답은 내 것 :) –

관련 문제