質問

たい全体ブロックを中心にその親がしたい内容をブロックを左揃えております。

例と最高の

このページ:

http://yaml-online-parser.appspot.com/?yaml=%23+ASCII+Art%0d%0a---+%7c%0d%0a++%5c%2f%2f%7c%7c%5c%2f%7c%7c%0d%0a++%2f%2f+%7c%7c++%7c%7c__%0d%0a&type=python

のスキーアート中心としたものであるべきである(表示されているとおり)ですが、ラインアップしよう"YAMLの".

この:

http://yaml-online-parser.appspot.com/?yaml=%3f+-+Detroit+Tigers%0d%0a++-+Chicago+cubs%0d%0a%3a%0d%0a++-+2001-07-23%0d%0a%0d%0a%3f+%5b+New+York+Yankees%2c%0d%0a++++Atlanta+Braves+%5d%0d%0a%3a+%5b+2001-07-02%2c+2001-08-12%2c%0d%0a++++2001-08-14+%5d%0d%0a

エラーメッセージは全機種ラインナップとしている。

役に立ちましたか?

解決 2

転載の回答のその他の質問 どのように水平にセンターが浮動小数要素の変動幅?

を想定した要素を浮かべますが中心であったのに対しては、div id="コンテンツ"...

<body>
<div id="wrap">
   <div id="content">
   This will be centered
   </div>
</div>
</body>

を適用し、以下のCSS

#wrap {
    float: left;
    position: relative;
    left: 50%;
}

#content {
    float: left;
    position: relative;
    left: -50%;
}

この参照のことについて http://dev.opera.com/articles/view/35-floats-and-clearing/#centeringfloats

他のヒント

まず、divとその子コンテンツを中心と親text-align: centerを作成します。次に、それは、必要に応じて左に揃える保持しているコンテンツを作るためにその子とdivの幅に適応するdisplay: inline-blockを使用して、子text-align: leftを作成します。

<div style="text-align: center;">
    <div style="display: inline-block; text-align: left;">
        Centered<br />
        Content<br />
        That<br />
        Is<br />
        Left<br />
        Aligned
    </div>
</div>

私はあなたによく理解していれば、あなたは、コンテナ(またはブロック)を中心に使用する必要があります。

margin-left: auto;
margin-right: auto;

と左にそれは内容があります揃えるます:

text-align: left;

通常のものを使用できる証拠金:0オートの本部長としてのその他の回答ができない幅を指定したdiv.したいという場合などを指定するには幅きはこのような利益のようなものmargin:0 200px×; このなすべき内容についているように見えるのは、きもののLeyuる 私の質問

<div>
    <div style="text-align: left; width: 400px; border: 1px solid black; margin: 0 auto;">
         <pre>
Hello
Testing
Beep
         </pre>
    </div>
</div>

これは、あなたが探しているものですか?フレキシボックス...

.container{
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-content: center;
  align-items: center;
}
.inside{
  height:100px;
  width:100px;
  background:gray;
  border:1px solid;
}
<section class="container">
  <section class="inside">
    A
  </section>
  <section class="inside">
    B
  </section>
  <section class="inside">
    C
  </section>
</section>

私はセンタリングする最も簡単な方法を見つけたと容器内部の左揃えのテキストは以下の通りです:

HTMLます:

<div>
  <p>Some interesting text.</p>
</div>

CSSます:

P {
  width: 50%; //or whatever looks best
  margin: auto; //top and bottom margin can be added for aesthetic effect
}

が、これはそれは私にちょうどこの非常に基本的な解決策を見つけ出すために検索のかなりを取ったとして、あなたが探していたものであると思います。

この作品

<div style="display:inline-block;margin:10px auto;">
    <ul style="list-style-type:none;">
        <li style="text-align:left;"><span class="red">❶</span> YouTube AutoComplete Keyword Scraper software <em>root keyword text box</em>.</li>
        <li style="text-align:left;"><span class="red">❷</span> YouTube.com website <em>video search text box</em>.</li>
        <li style="text-align:left;"><span class="red">❸</span> YouTube AutoComplete Keyword Scraper software <em>scraped keywords listbox</em>.</li>
        <li style="text-align:left;"><span class="red">❹</span> YouTube AutoComplete Keyword Scraper software <em>right click context menu</em>.</li>
    </ul>
</div>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top