001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.juneau.bean.html5; 018 019import org.apache.juneau.marshall.*; 020 021/** 022 * DTO for an HTML <a class="doclink" href="https://www.w3.org/TR/html5/text-level-semantics.html#the-span-element"><span></a> 023 * element. 024 * 025 * <p> 026 * The span element is a generic inline container for phrasing content. It has no inherent meaning 027 * and is typically used to group inline elements for styling purposes or to apply attributes to 028 * a portion of text. The span element is commonly used with CSS to apply styles to specific 029 * portions of text or to mark up text for JavaScript manipulation. 030 * 031 * <h5 class='section'>Examples:</h5> 032 * <p class='bcode w800'> 033 * <jk>import static</jk> org.apache.juneau.bean.html5.HtmlBuilder.*; 034 * 035 * <jc>// Text with highlighted portion</jc> 036 * Span <jv>highlight</jv> = <jsm>span</jsm>(<js>"This is highlighted text"</js>) 037 * .class_(<js>"highlight"</js>); 038 * 039 * <jc>// Text with multiple styled portions</jc> 040 * Span <jv>styled</jv> = <jsm>span</jsm>( 041 * <js>"Normal text "</js>, 042 * <jsm>span</jsm>(<js>"bold text"</js>).class_(<js>"bold"</js>), 043 * <js>" and "</js>, 044 * <jsm>span</jsm>(<js>"italic text"</js>).class_(<js>"italic"</js>) 045 * ); 046 * 047 * <jc>// Text with clickable portion</jc> 048 * Span <jv>clickable</jv> = <jsm>span</jsm>( 049 * <js>"Click "</js>, 050 * <jsm>span</jsm>(<js>"here"</js>).class_(<js>"link"</js>).onclick(<js>"showDetails()"</js>), 051 * <js>" for more information"</js> 052 * ); 053 * 054 * <jc>// Text with tooltip</jc> 055 * Span <jv>tooltip</jv> = <jsm>span</jsm>(<js>"Hover over this text"</js>) 056 * .title(<js>"This is a tooltip"</js>); 057 * 058 * <jc>// Text with language specification</jc> 059 * Span <jv>lang</jv> = <jsm>span</jsm>(<js>"Hola mundo"</js>) 060 * .lang(<js>"es"</js>); 061 * </p> 062 * 063 * <h5 class='section'>See Also:</h5><ul> 064 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 065 * </ul> 066 */ 067@Marshalled(typeName = "span") 068public class Span extends HtmlElementMixed<Span> { 069 070 /** 071 * Creates an empty {@link Span} element. 072 */ 073 public Span() {} 074 075 /** 076 * Creates a {@link Span} element with the specified child nodes. 077 * 078 * @param children The child nodes. Must not be <jk>null</jk>. 079 */ 080 public Span(Object...children) { 081 children(children); 082 } 083}