문제

나는 상자를 만들려면 다음과 같이 제목:

CSS box with title

할 수 있는 어떤 하나의 알려주시기 바랍 있는 경우 기본 CSS 태그 하면 이렇게 할 수 있습니까?또는 나를 만들 필요가 내 사용자 정의 스타일인가?

도움이 되었습니까?

해결책

내가 믿고 fieldset HTML 태그할 수 있는 스타일과 CSS.E.g.,

<fieldset style="border: 1px black solid">

<legend style="border: 1px black solid;margin-left: 1em; padding: 0.2em 0.8em ">title</legend>

Text within the box <br />
Etc
</fieldset>

다른 팁

를 사용하지 않는 경우에 그것을 형태,그리고 대신 사용하고 싶다는 편집할 수 없는 형태로,이를 수행할 수 있습을 통해 다음과 같은 코드

<div class="title_box" id="bill_to">
    <div id="title">Bill To</div>
    <div id="content">
        Stuff goes here.<br>
        For example, a bill-to address
    </div>
</div>

에서 CSS 로 파일

.title_box { 
    border: #3c5a86 1px dotted; 
}

.title_box #title { 
    position: relative; 
    top : -0.5em;
    margin-left: 1em;
    display: inline; 
    background-color: white; 
}

.title_box #content {
}

http://www.pixy.cz/blogg/clanky/css-fieldsetandlabels.html

<form>
  <fieldset>
  <legend>Subscription info</legend>
    <label for="name">Username:</label>
    <input type="text" name="name" id="name" />
    <br />
    <label for="mail">E-mail:</label>
    <input type="text" name="mail" id="mail" />
    <br />
    <label for="address">Address:</label>
    <input type="text" name="address" id="address" size="40" />
  </fieldset>
</form>


<style type="text/css">
fieldset { border:1px solid green }

legend {
  padding: 0.2em 0.5em;
  border:1px solid green;
  color:green;
  font-size:90%;
  text-align:right;
  }
</style>

이것은 당신에게 당신이 원하는 무엇을

<head>
    <title></title>
    <style type="text/css">
        legend {border:solid 1px;}
    </style>
</head>
<body>
    <fieldset>
        <legend>Test</legend>
        <br /><br />
    </fieldset>
</body>

내가 알기로는(의 경우 잘못!), 이 아닙니다.

내가 권하고 싶은 당신을 사용하 div 부정적인 수익-h1 내부입니다.에 따라 의미의 구조와 문서를 사용할 수도 있는 필드 집합(HTML)를 하나의 전설(HTML)내부에는 약 같이 기본적으로 합니다.

나는 생각이 들 수 있다 또한 누군가에게 도움이 될:

.fldset-class {
    border: 1px solid #0099dd;
    margin: 3pt;
    border-top: 15px solid #0099dd
}

.legend-class {
    color: #0099dd;
}
<fieldset class="fldset-class">
    <legend class="legend-class">Your Personal Information</legend>

    <table>
        <tr>
            <td><label>Name</label></td>
            <td><input type='text' name='name'></td>
        </tr>
        <tr>
            <td><label>Address</label></td>
            <td><input type='text' name='Address'></td>
        </tr>
        <tr>
            <td><label>City</label></td>
            <td><input type='text' name='City'></td>
        </tr>
    </table>
</fieldset>

당신이 밖으로 시도할 수 있습니다.

<fieldset class="fldset-class">
    <legend class="legend-class">Your Personal Information</legend>

    <table>
        <tr>
            <td><label>Name</label></td>
            <td><input type='text' name='name'></td>
        </tr>
        <tr>
            <td><label>Address</label></td>
            <td><input type='text' name='Address'></td>
        </tr>
        <tr>
            <td><label>City</label></td>
            <td><input type='text' name='City'></td>
        </tr>
    </table>
</fieldset>

데모

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top