2012-04-18 2 views
-1

H2 및 Div를 줄에 넣으려고하는데 작동하지 않습니다.줄에 요소 넣기

어디서 오류가 있습니까?

<div style="display:inline"><h2>LISTA DE SEDES</h2> |<div class="Create"> @Html.ActionLink("Create", "Create")</div></div> 

답변

1
<h2>

내측 DIV는 display:inline; 아닌 외부 DIV 있어야한다.

1

이 시도 :

<div style="display:inline"><h2 style="display:inline;">LISTA DE SEDES</h2> |<div class="Create" style="display:inline;"> @Html.ActionLink("Create", "Create")</div></div> 

당신은 볼 수 :

LISTA DE SEDES | @Html.ActionLink("Create", "Create") 

표시 인라인. 또한 수레와 함께 작업을 수행 할 수 있습니다

<style type="text/css"> 
.float_left { 
    float:left; 
} 
.clear { 
    clear:both; 
} 
</style> 
<div class="float_left"> 
<h2 style="display:inline;">LISTA DE SEDES</h2> 
</div> 
<div class="float_left"> | </div> 
<div class="float_left"><div class="Create"> @Html.ActionLink("Create", "Create")</div></div> 
<div class="clear"></div> 
0

당신이 당신의 중첩 <div>가 인라인 표시 할 경우 <h2> 당신이 중첩 된 DIV 자체에 display: inline를 적용해야합니다. 헤더 요소도 기본적으로 블록으로 표시되므로 인라인으로 표시하려면 <h2>을 지정해야합니다.

<div><h2 style="display: inline">LISTA DE SEDES</h2> |<div class="Create" style="display: inline"> @Html.ActionLink("Create", "Create")</div></div>​ 

여기 데모를 참조하십시오 : http://jsfiddle.net/t5FEX/

0

야이

<div style="display: inline-block;"> 
<h2 style="display: inline-block;">LISTA DE SEDES</h2> | 
<div class="Create" style="display: inline-block;"> @Html.ActionLink("Create", "Create")</div> 
</div> 

라이브 데모 등이 display inline-block

을 사용한다 http://jsfiddle.net/rohitazad/t5FEX/1/