cssを使って文字を折り返す

CSSを使って文章を折り返す方法
疑似要素の『:before』を使って改行
■css
.test:before{
content:”テスト\A”;
white-space: pre;
}
■html

テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキ
ストテキストテキストテキストテキストテキスト

■結果
テスト
テキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキストテキ
ストテキストテキストテキストテキストテキスト

スタイルシートのエラーチェック

W3C CSS 検証サービス
http://jigsaw.w3.org/css-validator/#validate_by_uri+with_options
上記のサイトでは、1URL,2アップロード,3直接入力でCSSを検証出来ます。

■エラーの種類
警告メッセージ
ベンダープレフィックスを使用している箇所はエラー扱いになる
can’t find the warning message for vendor-extension

独自拡張である疑似要素を使っていると出てくる警告
can’t find the warning message for vendor-ext-pseudo-element

プラグイン:Breadcrumb NavXT

面倒なパンクズの構築を解決してくれるプラグインをご紹介します。
Breadcrumb NavXT
https://ja.wordpress.org/plugins/breadcrumb-navxt/

インストールが完了したら、設定をしましょう。

後は設置した場所に下記のコードを追加しましょう。

<div class="breadcrumbs" typeof="BreadcrumbList" vocab="http://schema.org/">
  <?php if(function_exists('bcn_display'))
  {
   bcn_display_list();
  }?>
</div>

※bcn_display_list();で

  • タグでの出力、bcn_display();だとタグで出力されます。

    カスタムタクソノミーでタームを階層化していると、結構パンクズに悩まされますが、
    このプラグインを使うことで解決できました。

  • vertical-alignが効かない時

    vertical-alignが効かないときにtable-cellを書いても効かなかったとき、親要素にdisplay: table;をかける必要があります

    ■html
    <div class=”contents”>
    <div class=”box”>
    <img src=”xxxxx.jpg”>
    </div>
    </div>

    ■css
    .contents {
    display: table;
    }
    .box{
    display: table-cell;
    vertical-align: middle;
    }