the <p> html tagWebsites by Mark - 7 Woodrush gardens, Carterton, Oxfordshire. OX18 1JE

the <p> html tag
the <p> html tag

The <p> html tag

Overview

In simple terms the <p> HTML tag stands for paragraph. When text is put between the opening and closing <p> tag it is displayed as a paragraph. It is for this reason when you view most of the body copy in the source of a webpage you will see it sitting between <p></p>

Basic Usage

 <p>Some text in here</p>
Any text between the opening and closing tag will be displayed as a paragraph.

Advance Usage

It is possible to style and add functionality to the <p> tag, this is done by adding an attribute to after the p in the opening <p> tag
Attributes allowed for the <p>tag include :-class, dir, id, lang, style and title.
In most cases class and id are used and its basic usage is shown below
<p id=”header”>Some text</p>
With all attributes there is a space after the initial p then the attribute name, then an equal’s sign and the identifier of the attribute in double quotes.
Both id and class attributes refer to CSS styling of the element and is either stored in the <head> of the webpage on in an external file.
With id this usually refers to a single instance on a page where as class usually refers to a repeating element on a page, it is for this reason for the <p> tag the class attribute is nearly always used over the id attribute.
The attribute style allows you to include css style information for a single <p> tag.
The dir attribute allows for left reading and right reading text, lang allows you to specify a language for the tag and title allows you to include extra information for a tag.
It is possible to attach scripts to tags, as well adding functionality to a webpage, these scripts tend to be written in Javascript and therefore outside the scope of this document

Examples

<p>Some text</p> – basic usage example.
<p id=”header>Some text</p> – Paragraph which is styled by the id header.
<p class=”headerclass”> Some text </p> – Paragraph which is styled by the class headerclass.
<p id =”header” class=”headerclass”> Some text </p> – Paragraph which is styled by the class headerclass and the id header.
<p style="color:#F00">Some text</p> – Paragraph which has a custom colour of red.
<p dir="rtl">Some text</p> – Paragraph where the text reads from right to left.
<p lang="uk">Some text</p> – Paragraph where the language has been tagged as UK.
<p title="ptitle">Some text</p> – Paragraph where the tag has been titled ptitle.

Final Thoughts

Touching on just the surface of the <p> HTML tag it is easy to see how versatile it is. To take full advantage of it an understanding of CSS is an advantage.

Our blog

Some random stories from our blog.

Case Study – Inyanga Counselling

Therapy and crisis counselling still is stigmatised by many, which made the design and creation of the site interesting as well as being a very worthwhile project to be involved in. At the initial brief it was very clear that counselling is not only a very personal service but the service is used by all levels of society and as such the site needed to reflect this. Using warm neutral visuals that complimented the colour and feel of the logo was matched by a very personal blog style site, which allowed people visiting the site to know they were dealing with a real qualified person. As with all sites developed by Websites by Mark both large and small, the same quality and care is shown and this was indeed the same in Mary’s case. As with many of Websites by Marks projects, design and build was complete on time and…

The cost of free website builders

With the daily rise of online services that promise to create and host a website for free. Is it good news for everyone, or a case of too good to be true? The birth of free From its inception people have constantly looked for cheaper and cheaper ways to access the internet and get the benefits of the digital life. From the start Companies like AOL offered discount packages for the masses to get online cheaply. Often the discounts came at a price like poor connection speeds and service but in an age where the internet was new and shiny, many people were happy to put up with most things just to get online. Businesses were quick to realise the power the internet and what it had to offer, but for many the perceived costs were just too much. It was not long before certain companies started to appear on…

Keyword use in document title

Overview In search engine optimisation it is well known that Google considers text used in the document title a good indication of what the web page is about. The document title of a webpage is contained within <title> html tag which itself must be included in the <head> part of the html page. If the title tag is malformed, search engines like Google may not read the page properly and not rank your page accordingly. History of the <title> tag The <title> tag in HTML is available in every version of HTML and is seen equally by all web browsers which support the html standard. It normally appears above the page in the browsers application bar. It can also used by Google as a title for your webpage in its listings. Therefore it is important not only to have your keywords to appear in the title tag, but presented in…

Should Google Blogger off?

Google recently announced a major upgrade to its free blogging platform Blogger. Does this represent a real leap forward in personalised communication or just another Google Application with little appeal outside the casual blogger? Blogging killed the DIY home page Free blogging services have been around for many years now and offer a great way to get that latest irritation off your chest. Many blogs are now used instead of personal websites, this comes down to many reasons but for most non technical users the power of a blog comes from being able to add new content in minutes and at the click of a button give the site a makeover. Although there are many of hosted blogs to choose from Blogger from Google is extremely popular. Blogger offers for free a way for users to create blog websites in a very short period of time, add functionality and the…

Top level domain of web site

Overview When most people think of larger websites it’s no coincidence that most people expect to see a .com Not only was .com was one of the first types of domain available it’s also known as a Top level domain. For years a .com often secured a good ranking due to its status but when country based domains (i.e. .co.uk) started to grow in popularity Search engine started to see this new level of domain potentially being more relevant for local search result. As a general rule a Top level domain is more relevant for those companies how have an international presence. The importance of Top level domain of web site Originally domain prices were very expensive and it’s only in recent years that the costs have come down to very affordable levels. This means domains are often bought now on the basis on what search engine optimisation benefits it…

© 2011 Websites by Mark. Do not reproduce any part of this website without permission.
Email : mark@websitesbymark.co.uk - Phone : 07716 447228 / 01993 820005
Postal Address : 7 Woodrush Gardens, Carterton, Oxfordshire. OX18 1JE