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/grouping-content.html#the-p-element"><p></a> 023 * element. 024 * 025 * <p> 026 * The p element represents a paragraph of text. It is one of the most commonly used HTML elements 027 * for structuring text content. Paragraphs are block-level elements that automatically add spacing 028 * before and after the content, making them ideal for organizing textual information into readable sections. 029 * 030 * <h5 class='section'>Examples:</h5> 031 * <p class='bcode w800'> 032 * <jc>// Simple paragraph</jc> 033 * P <jv>simple</jv> = <jsm>p</jsm>(<js>"This is a simple paragraph of text."</js>); 034 * 035 * <jc>// Paragraph with styling</jc> 036 * P <jv>styled</jv> = <jsm>p</jsm>(<js>"This paragraph has custom styling."</js>) 037 * .class_(<js>"lead"</js>); 038 * 039 * <jc>// Paragraph with mixed content</jc> 040 * P <jv>mixed</jv> = <jsm>p</jsm>( 041 * <js>"This paragraph contains "</js>, 042 * <jsm>strong</jsm>(<js>"bold text"</js>), 043 * <js>" and "</js>, 044 * <jsm>em</jsm>(<js>"italic text"</js>), 045 * <js>"."</js> 046 * ); 047 * 048 * <jc>// Paragraph with link</jc> 049 * P <jv>withLink</jv> = <jsm>p</jsm>( 050 * <js>"Visit our "</js>, 051 * <jsm>a</jsm>(<js>"/help"</js>, <js>"help page"</js>), 052 * <js>" for more information."</js> 053 * ); 054 * 055 * <jc>// Paragraph with ID and class</jc> 056 * P <jv>withAttrs</jv> = <jsm>p</jsm>(<js>"Important notice"</js>) 057 * .id(<js>"notice"</js>) 058 * .class_(<js>"alert alert-warning"</js>); 059 * 060 * <jc>// Paragraph with inline styles</jc> 061 * P <jv>withStyle</jv> = <jsm>p</jsm>(<js>"Styled paragraph"</js>) 062 * .style(<js>"color: blue; font-size: 16px;"</js>); 063 * </p> 064 * 065 * <p> 066 * The following convenience methods are provided for constructing instances of this bean: 067 * <ul class='javatree'> 068 * <li class='jc'>{@link HtmlBuilder} 069 * <ul class='javatree'> 070 * <li class='jm'>{@link HtmlBuilder#p() p()} 071 * <li class='jm'>{@link HtmlBuilder#p(Object...) p(Object...)} 072 * </ul> 073 * </ul> 074 * </p> 075 * 076 * <h5 class='section'>See Also:</h5><ul> 077 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanHtml5">juneau-bean-html5</a> 078 * </ul> 079 */ 080@Marshalled(typeName = "p") 081public class P extends HtmlElementMixed<P> { 082 083 /** 084 * Creates an empty {@link P} element. 085 */ 086 public P() {} 087 088 /** 089 * Creates a {@link P} element with the specified child nodes. 090 * 091 * @param children The child nodes. 092 */ 093 public P(Object...children) { 094 children(children); 095 } 096 097}