text-align Property


Home > Document > CSS > Text > text-align

ÆäÀÌÁö ¸ñÂ÷

text-align Property

text-align Property ´Â ±ÛÀÚÀÇ ¼öÆò Á¤·ÄÀ» ´Ù·ç´Â PropertyÀÔ´Ï´Ù. ¼öÆò Á¤·Ä ¹æ½Ä¿¡´Â ¿ÞÂÊ ¸ÂÃã(left : default, direction ltr ¿¡¼­), ¿À¸¥ÂÊ ¸ÂÃã(right), °¡¿îµ¥ ¸ÂÃã(center), ¾çÂÊ ¸ÂÃã(justify), ±ÛÀÚ ¸ÂÃã(string) ¹æ½ÄÀÌ Àִµ¥ ±ÛÀÚ ¸ÂÃãÀº Àû¿ëµÇÁö ¾Ê½À´Ï´Ù.

  [Ç¥ º¸´Â ¹æ¹ý]
text-align Property
Value left | right | center | justify | <string> | Inherit
Initial depends on user agent and writing direction
Applies to block-level elements
Inherited yes
Percentages N/A
Media Visual
HTML Syntax { text-align: sAlign }
Scripting object.style.textAlign [ = sAlign ]




CSS Scripting
onMousedown="this.style.textAlign='center';"




Tag ÀÚ½Å(this)ÀÌ ¾Æ´Ñ ´Ù¸¥ Tag¿¡ µ¿ÀûÀÎ º¯È­¸¦ ÁÖ´Â ¹æ¹ý

¹«½¼ ¶æÀÎÁö ¼³¸íÇϱâ À§Çؼ­ ´ÙÀ½ÀÇ object-1 °ú object-2¿¡ ¸¶¿ì½º¸¦ ¿Ã·Á º¸½ÃÁÒ. ±×·¯¸é Tag ¿¡ Mouse°¡ ¿Ã¶ó °¬À» ¶§ ±× Tag ½º½º·Î¿¡ ±ÛÀÚ°¡ center·Î Á¤·ÄÇÏ´Â º¯È­°¡ »ý±é´Ï´Ù.

object-1 object-2

À̹ø¿£ ¾Æ·¡ÀÇ object-1 °ú object-2 ¿¡ ¸¶¿ì½º¸¦ ¿Ã·Áº¸¸é ¸Õ°¡ ´Ù¸¥ º¯È­°¡ »ý±â°Ô µË´Ï´Ù. Áï, object-1¿¡ ¸¶¿ì½º¸¦ ¿Ã¸®¸é object-2°¡ center¿¡ Á¤·ÄÀÌ µÇ°í, object-2¿¡ ¸¶¿ì½º¸¦ ¿Ã¸®¸é object-1 ÀÇ ±ÛÀÚ°¡ center¿¡ Á¤·ÄµÇ´Â °ÍÀ» º¼ ¼ö ÀÖ½À´Ï´Ù. ¹Ù·Î ÀÌ·¸°Ô ÇÏ´Â ¹æ¹ý¿¡ ´ëÇØ ¼³¸íÇÏ·Á°í ÇÏ´Â °ÅÁ®.

object-1 object-2


Áغñ »çÇ×

¸ÕÀú ÀÚ½Å(this)ÀÌ ¾Æ´Ñ ´Ù¸¥ object Element ÀÇ ¼Ó¼º(Attribute) Áß¿¡ 'name' ¼Ó¼ºÀÌ ÀÖ´ÂÁö È®ÀÎ ÇÕ´Ï´Ù. ÀÖÀ¸¸é À̸§À» ºÙÇô ÁÝ´Ï´Ù. ¿¹¸¦ µé¾î
  1. ¸ÕÀú ÀÚ½Å(this)ÀÌ ¾Æ´Ñ ´Ù¸¥ object Element ÀÇ ¼Ó¼º(Attribute) Áß¿¡ 'name' ¼Ó¼ºÀÌ ÀÖ´ÂÁö È®ÀÎ ÇÕ´Ï´Ù. ÀÖÀ¸¸é À̸§À» ºÙÇô ÁÝ´Ï´Ù. ¿¹¸¦ µé¾î

    <IMG name="img_1" src="..."> °ú °°ÀÌ...

  2. name ¼Ó¼ºÀÌ ¾ø¾î¼­ namingÀ» ÇÒ ¼ö ¾ø´Ù¸é ¹Ù·Î ÀÌ ¶§ »ç¿ëÇÏ´Â ¹°°ÇÀÌ id ¶ó´Â ³ÑÀÌÁ®. ¾Æ·¡¿Í °°ÀÌ ÇÕ´Ï´Ù.
    <TABLE border="0" cellspacing="10" width="100%">
        <TR>
            <TD id="td_1">object-1</TD>
            <TD id="td_2">object-2</TD>
        </TR>
    </TABLE>
    
  3. ÀÌ¿Í °°ÀÌ name ¶Ç´Â id ·Î Tag À» È£Ãâ ÇÒ ¼ö ÀÖ´Â object ·Î ¸¸µé¾ú´Ù¸é ÀÌÁ¦ ¾Æ·¡¿Í °°ÀÌ scripting ÇÕ´Ï´Ù.

    <HTML>
        <HEAD>
            <TITLE></TITLE>
        <STYLE type="text/css">
        <!-- 
        .gold {border:1px solid #000000;background-color:gold;}
        .blue {border:1px solid #000000;background-color:royalblue;color:#ffffff;}
        -->
        </STYLE>
        </HEAD>
        <BODY>
            <TABLE border="0" cellspacing="10" width="100%">
                <TR>
                    <TD id="td_1" class="gold" onMouseOver="td_2.style.textAlign='center';"
                    onMouseOut="td_2.style.textAlign='';">object-1</TD>
                    <TD id="td_2" class="blue" onMouseOver="td_1.style.textAlign='center';"
                    onMouseOut="td_1.style.textAlign='';">object-2</TD>
                </TR>
            </TABLE>    
        </BODY>
    </HTML>
    


Ãâ·Â°á°ú
object-1 object-2




text-align Property DHTML
ÀÔ·Â
<HTML>
    <HEAD>
        <TITLE></TITLE>
    <STYLE type="text/css">
    <!-- 
        .para{
        text-align:center;
        color:#333366;
        width:100%;
        border:1px solid #c0c0c0;
        background:#dfdfdf;
        font:11px/1.6em Verdana;
        padding:10px;
        }
				
        .td_btn{
        height:18px;
        background-color:royalblue;
        border:1px solid #808080;
        cursor:pointer;
        font:11px;
        color:#EFEFEF;}  
    -->
    </STYLE>
    </HEAD>
    <BODY>
    <DIV id="div_1" class="para">
        Powell's April 14 letter to Defense Secretary Donald H. Rumsfeld said the U.S. still was 
        questioning some 660 prisoners from 42 countries about al-Qaida and other terrorist 
        activities. The prisoners have been held without trial and do not have access to lawyers.
        A Pentagon official, speaking on condition of anonymity, said the "strongly worded" 
        letter made it clear that the secretary of state wanted the Defense Department to quickly
        determine which prisoners could be released.
    </DIV>
    <table border="1" width="100%" cellspacing="2" cellpadding="0" style="table-layout:fixed;">
        <tr align="center">
            <td class="td_btn" onmousedown="div_1.style.textAlign='left';">left (default)</td>
            <td class="td_btn" onmousedown="div_1.style.textAlign='right';">right</td>
            <td class="td_btn" onmousedown="div_1.style.textAlign='center';">center</td>
            <td class="td_btn" onmousedown="div_1.style.textAlign='justify';">justify</td>
        </tr>
    </table>    
    </BODY>
</HTML>

Ãâ·Â °á°ú (Mouse Down & Up)
Powell's April 14 letter to Defense Secretary Donald H. Rumsfeld said the U.S. still was questioning some 660 prisoners from 42 countries about al-Qaida and other terrorist activities. The prisoners have been held without trial and do not have access to lawyers. A Pentagon official, speaking on condition of anonymity, said the "strongly worded" letter made it clear that the secretary of state wanted the Defense Department to quickly determine which prisoners could be released.
left (default) right center justify


Âü°í»çÇ×
À§ÀÇ ÀÔ·Â Source ¿Í °°ÀÌ Style block ¼Ó¿¡ class selector¸¦ ÁöÁ¤ÇÒ ¶§ class ¿¡ »ç¿ëµÇ´Â Property °¡ ¸¹À¸¸é 1 ÁÙ¿¡ 1°³ÀÇ Property ¾¿ Á¤¸®ÇÏ´Â °ÍÀÌ ÁÁÀº ¹æ¹ý ÀÏ ¼ö ÀÖ½À´Ï´Ù. ÇÑ ÁÙ·Î ±æ°Ô ³ª¿­ÇÏ°Ô µÇ¸é º¸±âµµ ºÒÆíÇÒ »Ó´õ·¯ colon ( : ) À̳ª semi-colon ( ; ) À» Àß ¸ø Âï°Å³ª »© ³õ¾ÒÀ» °æ¿ì ÇÑ ´«¿¡ µé¾î¿ÀÁö ¾ÊÁö¸¸ 1 ÁÙ¿¡ 1°³ÀÇ Property ¾¿ Á¤¸®ÇÏ¸é ±×·± ½Ç¼ö¸¦ ÁÙÀÏ ¼ö ÀÖ½À´Ï´Ù.





ÀÌ ¹®¼­ÀÇ ÀúÀÛ±ÇÀº www.cadvance.org ¿¡ ÀÖ½À´Ï´Ù.

Top
Back
New
°Ë»ö