` element, but `
` is a block-level element whereas a `
` is an
+ * inline element.
+ *
+ * @param array $attributes The tag attributes in terms of name-value pairs. These will be rendered as the
+ * attributes of the resulting tag. The values will be HTML-encoded using {@see Attributes::encode()}.
+ * See {@see Attributes::render()} for details on how attributes are being rendered.
+ * @param string $content The content of the tag.
+ *
+ * @return string The generated `` HTML element.
+ *
+ * @link https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-span-element
+ * @link https://html.spec.whatwg.org/multipage/dom.html#global-attributes
+ */
+ public static function span(array $attributes = [], string $content = ''): string
+ {
+ return self::create('span', $content, $attributes);
+ }
+
/**
* The `` HTML element represents an unordered list of items, typically rendered as a bulleted list.
*
diff --git a/tests/Tag/DivTest.php b/tests/Tag/DivTest.php
new file mode 100644
index 00000000..dce7ac07
--- /dev/null
+++ b/tests/Tag/DivTest.php
@@ -0,0 +1,35 @@
+' . PHP_EOL . '
'],
+ [['class' => 'class'], '', '
' . PHP_EOL . '
'],
+ [[], 'Content', '
' . PHP_EOL . 'Content' . PHP_EOL . '
'],
+ ];
+ }
+
+ /**
+ * @dataProvider createProvider
+ *
+ * @param array $attributes Tag attributes.
+ * @param string $content Tag content.
+ * @param string $expected Expected result.
+ */
+ public function testCreate(array $attributes, string $content, string $expected): void
+ {
+ $assert = new Assert();
+
+ $assert->equalsWithoutLE($expected, Tag::div($attributes, $content));
+ }
+}
diff --git a/tests/Tag/SpanTest.php b/tests/Tag/SpanTest.php
new file mode 100644
index 00000000..d1a3fb8d
--- /dev/null
+++ b/tests/Tag/SpanTest.php
@@ -0,0 +1,35 @@
+'],
+ [['class' => 'class'], '', '
'],
+ [[], 'Content', '
Content'],
+ ];
+ }
+
+ /**
+ * @dataProvider createProvider
+ *
+ * @param array $attributes Tag attributes.
+ * @param string $content Tag content.
+ * @param string $expected Expected result.
+ */
+ public function testCreate(array $attributes, string $content, string $expected): void
+ {
+ $assert = new Assert();
+
+ $assert->equalsWithoutLE($expected, Tag::span($attributes, $content));
+ }
+}