Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="startElement">開始位置</div>
<div id="endElement">終了位置</div>
<script src="https://cdn.jsdelivr.net/npm/leader-line@1.0.1/leader-line.min.js"></script>
              
            
!

CSS

              
                /* 開始位置の要素 */
#startElement {
  /* 高さ */
  height: 4em;
  /* 幅 */
  width: 4em;
  /* 背景色 */
  background-color: lightpink;
}

/* 終了位置の要素 */
#endElement {
  /* マージン */
  margin-top: 100px;
  margin-left: 120px;
  /* 高さ */
  height: 4em;
  /* 幅 */
  width: 4em;
  /* 背景色 */
  background-color: lightblue;
}

              
            
!

JS

              
                // 開始位置の要素
const start = document.getElementById("startElement");
// 終了位置の要素
const end = document.getElementById("endElement");

/** 線を弾くleader-line.jsの関数
 * start 開始位置の要素,
 * end 終了位置の要素,
 * {}内のオプション その他設定
 */
new LeaderLine(
  // ホバーしたら線を引く
  // LeaderLine.mouseHoverAnchor(start),
  start,
  // 終了位置の要素を枠で囲う
  LeaderLine.areaAnchor(end),
  // その他オプション
  {
    x:"100%",
    // 線の形状
    path: "straight", // 直線
    // 線の色
    color: "red",
    // 線の太さ
    size: 2,
    // 開始位置の形状
    startPlug: "square", // 四角形
    startPlugSize: 2,
    // 終了位置の形状
    endPlug: "arrow3", // 矢印
    endPlugSize: 3,
    // アニメーション
    dash: { animation: true },
    // テキスト
    startLabel: LeaderLine.pathLabel({
      text: "線に沿ったテキスト",
      color: "pink",
      background: "gray",
    }),
    middleLabel: "中間位置のテキスト",
    endLabel: "終了位置のテキスト",
  }
);

              
            
!
999px

Console