HTML๐Ÿ”จ/html&css ํผ์š”์†Œ

css form input type="text" readonly ๋ฌธ์˜ํ•˜๊ธฐ ๋งŒ๋“ค๊ธฐ

hyojinny 2022. 10. 10. 18:20

 

 

 

์ดˆ๊ธฐํ™”์ฝ”๋“œ๋กœ form ๋””์ž์ธ ์—†์• ๊ธฐ

 

 

/* legend,caption,๋ฉ”๋‰ด์ œ๋ชฉ,์„น์…˜์ œ๋ชฉ ๋ธ”๋ผ์ธ๋“œ */
legend, caption, .blind { position: absolute; overflow: hidden; clip: rect(0 0 0 0); margin: -1px; width: 1px; height: 1px }
 
/* ์นธ์˜ ์„ ์„ ํ•ฉ์น˜๊ธฐ, ์นธ์˜ ๊ฐ„๊ฒฉ์—†์• ๊ธฐ, ๊ฐ€๋กœ๋ฅผ ๋Š˜๋ ค์คŒ */
table {border-collapse: collapse; border-spacing: 0; width: 100%; table-layout: fixed;}
 
 

์˜ˆ์ œ์ฝ”๋“œ 

            <form>
              <fieldset>
                <legend>๋ฌธ์˜์ž‘์„ฑํ•˜๊ธฐ</legend>
                <div class="inquri_wrap">
                  <table>
                    <caption>๋ฌธ์˜ํ•˜๊ธฐํ…Œ์ด๋ธ”</caption>
                      <tr>
                        <th class="col01">์ด๋ฆ„<i class="star"></i></th>
                        <td><input type="text" readonly value="๋ฐ•ํšจ์ง„" title="์ด๋ฆ„์ž…๋ ฅ"></td>
                      </tr>
                      <tr>
                        <th>์—ฐ๋ฝ์ฒ˜<i class="star"></i></th>
                        <td><input type="text" title="์—ฐ๋ฝ์ฒ˜์ž…๋ ฅ"></td>
                      </tr>
                      <tr>

 

readonly  

 

 ์ด๋ฆ„ ๋ถ€๋ถ„์ด ๋จผ์ € ๋“ค์–ด๊ฐ€์žˆ๊ณ  ์‚ฌ์šฉ์ž๊ฐ€ ์“ธ์ˆ˜ ์—†๋„๋ก ๋ฏธ๋ฆฌ ์ง€์ •ํ•ด์ค€๋‹ค

<td><input type="text" readonly value="๋ฐ•ํšจ์ง„" title="์ด๋ฆ„์ž…๋ ฅ"></td>

 

(title ๋ฏธ์ ์šฉ์‹œ ์›น ์ ‘๊ทผ์„ฑ ๊ฒฝ๊ณ )


ํ‘œ ๋””์ž์ธ

 

ํ…Œ์ด๋ธ”์˜ ์ฒซํ–‰ ์„น์…˜์ด ์—†์œผ๋ฏ€๋กœ thead๋Š” ํ•„์š”์—†์Œ

๋‹จ th๋กœ ์ฒซ์—ด ์นธ์ด๋ฆ„์„ ์ง€์ •ํ•˜์—ฌ ํด๋ž˜์Šค๋ช…์œผ๋กœ ๋„“์ด๋ฅผ ์ง€์ •ํ• ์ˆ˜ ์žˆ๊ฒŒํ•œ๋‹ค.

<!-- thead๊ฐ€ ์—†์„๊ฒฝ์šฐ table-layout:fixed ์—†์–ด์•ผ ๊ธธ์ด ์กฐ์ •๋จ -->

 

 

 

html ์ž‘์„ฑ ์˜ˆ )
<th class="col01">์ด๋ฆ„<i class="star"></i></th>


 

ํ‘œ ๊ธธ์ด ์ž๋™์กฐ์ • 

.inquiry_page .inquiry_area table {
    table-layout: auto;
}

 

 

๋””ํ…Œ์ผ ๋””์ž์ธ ์กฐ์ • 

.inquiry_page .inquiry_area th {
    border-bottom: 1px solid #e8e8e8;
    padding: 12px 0;
    text-align: left;
    font-weight: 500;
}

 

์ง€์ •ํ•ด์คฌ๋˜ ์ฒซํ–‰์นธ์˜ ํด๋ž˜์Šค๋ช…์œผ๋กœ ๋„“์ด์กฐ์ • 

.inquiry_page .inquiry_area .col01 {
    width: 130px;
}
.inquiry_page .inquiry_area td {
    border-bottom: 1px solid #e8e8e8;
    padding: 12px 0;
}

์†์„ฑ์„ ํƒ์ž์— focus ๋กœ ํ…Œ๋‘๋ฆฌ์„  ์—†์• ์ฃผ๊ธฐ

.inquiry_page .inquiry_area input[type=text]:focus {
    outline: none;
}