My 4 secrets for creating a regular blog

Posted by on January 16th, 2013

My 4 secrets for creating a regular blog
Blogging seems to be one of those things that many people start, yet few manage to keep going. I think a lot of people have the desire to write about what they are passionate about and publish it online, but turning that passion into a regular form of content can be extremely difficult.

When I first started this website, I would go through phases of writing, and then long periods of neglect. I just couldn’t find it in myself to produce content on a regular basis, even though I had the desire to do so.

I think there is so much value in regularly writing your thoughts on a subject and publishing it online for anyone to read. Writing really cements your understanding of a topic when you are forced to explain it in your own words. I also think the ability to write clearly is a huge asset, no matter what industry you work in or what your job entails. Writing is all about clarity of thought and being able to communicate effectively. If you write regularly over a sustained period of time, you will eventually become a really good writer.

Also, don’t think you can’t do it just because you are not a “writer”. I am by no means a natural writer, and I actually struggled through English lessons throughout my education. Until just a couple of years ago, I hated writing, but I think it’s not until you are actually writing about something you care about that your passion starts to show.

So if you are looking to start a blog, or you have given up in the past and want to try again, here are my 4 secrets for writing regular content. These 4 things actually worked for me, so I hope they will work for you too. Take a look at the dates of my first 20 or so posts to see how I struggled to post regularly at the beginning!

1. Set a schedule

The first really important thing to do is to set yourself a schedule. Unless you have a set schedule to meet, you will never be able to post regularly.

A lot of people want to blog only when an idea strikes them. If that is the kind of blog you want to write it is unlikely that it will ever become “regular”. Writing whenever the mood strikes, or when you think of an idea that is worthy to be written about won’t happen very regularly. There’s nothing wrong with this kind of blog, but it will always be sporadic and it will never grow a following.

A schedule forces you to be more creative and think of topics to write about. When you know you have a schedule to meet, you start to get into the habit or producing more ideas on a regular basis.

I wanted Culttt to be a very active website and so I decided I would post 3 times a week. You might not want to make this kind of commitment to writing, but you need to make a commitment based upon the investment you want to make.

You also need to hold yourself accountable to meet the schedule. A schedule is pointless if you miss it. Start with a target that you can easily hit. Once you start getting traffic and your website starts to grow, it becomes much harder to miss your schedule.

2. Block out time to write

Once you have your schedule in place, you need to set a routine in order to produce the content. Setting a routine is important because if you don’t, you won’t hit your schedule.

Setting a routine to write is exactly the same as learning or improving anything. For example, if you were having piano lessons once a week, you would need to set yourself a routine to practice, or when the lessons comes round each week you would show no improvement. Think of your schedule dates as your piano lesson.

Blocking out time to write is important because it forces you to sit down and do the work. If you don’t set yourself a routine, you won’t end up writing.

3. Write no matter what

Like an type of art, writing can often be difficult. Either it is a struggle to convey an idea, or you live in fear that what you write is not good enough. This is made even worse when you have a schedule to meet, and you’ve blocked out time in order to write. It’s easy to find yourself sitting for a long time, staring at a blank document.

I’ve found the best way to solve this problem is just to write no matter what. My first draft of a post is often terrible as I quickly get everything I want to say out of my head and into a working document. The majority of the time I’m just writing out a list of bullet points of areas I want to cover, or I write down all the section headers without ever writing out a proper sentence. If you do this, you can very quickly get the structure of a post, without the struggle of writing the first paragraph.

Whenever I write a post, I write out the headings and then just write as much as I can under each section. Once I think I’ve written all my ideas down, I save the document and call it a night.

I don’t usually look at the post again until I want to put it into WordPress. When you come back to a post that you’ve written, it is much easier to edit it down to exactly what you want to say. Coming back with a fresh set of eyes enables you to critically evaluate what you have written so you can re-write or re-organise it so it reads more clearly.

Part of writing regularly is also about getting over the fear of your writing not being good enough. When you are shooting for a gruelling schedule, you don’t have time to painstakingly edit every word.

Real artists ships.

4. Always be formulating

The final problem with writing regular content is formulating enough ideas for content. It’s difficult to sit down and start writing in your allotted writing block if you have nothing to write about. It is much easier if you already have a list of ideas for potential posts as you can just start writing straight away.

In order to write regularly, you really have to surround yourself within your niche. Hopefully you have picked a topic that you are passionate about, and so you already have a lot to say.

I find one of the best ways to start formulating more ideas is to read a lot of content. I have over 150 RSS feed subscriptions in my Google Reader account that I clear down every day. Whenever I see something interesting I just star it so I can come back to it later. I also follow a lot of people on Twitter who regularly post links to interesting content. Again I just favourite it so I can come back to it and read it when I have time.

I read all different types of content from a wide range of different websites. From big media companies, to individual bloggers. I find having a wide range of different types of content enabled me to discover the type of content I want to write.

When you start reading a lot of content from a particular niche, you begin to synthesis the various ideas that you read and mix them with your own. This enables you to subconsciously spot patterns or come up with ideas for original content. You will probably also see posts in a particular format which would work well for a different idea that you have.

It’s difficult to come up with a regular stream of ideas, but you can make it a lot easier if you provide yourself with the right type of inspiration.

And finally, have some way of writing down notes or ideas for blog posts. I use Evernote all the time to store lists of post ideas and random thoughts that could potentially grow into a post. Sometimes someone will mention something to you that triggers an idea for a post. Personally, if I don’t write it down immediately, I will never think of it again. Keeping a centralised list of post ideas in Evernote makes it a lot easier to start writing as soon as I sit down in my allotted time.

Conclusion

I’m not going to lie to you, writing a regular blog is a lot of hard work, but the huge amount of opportunity it grants you in the long run is worth the effort. It enables you to make something really great over a long sustained period of time bit by bit.

Hopefully these four things will encourage or help you to start regularly blogging too. I really struggled to write regularly for a long time, but by finding what works for you, you too can start building something you really care about.

STEPS TO MAKE ONLINE PASSPORT

नई दि‍ल्‍ली। सरकार जल्‍द ही पासपोर्ट और बनाने की प्रक्रि‍या में आधार कार्ड को आवश्‍यक बनाए जाने की योजना बना रही है। सरकार इस प्रक्रिया से आवेदक की आपराधिक गति‍वि‍धि‍यों के सत्यापन की प्रणाली स्थापित करने की कोशिश भी की जा रही है। नई प्रक्रिया के तहत यदि कोई पासपोर्ट के लिए आवेदन करता है और आधार नहीं होने पर पहले उसे आधार कार्ड बनवाना पड़ सकता है।
यह कदम पीएम नरेंद्र मोदी के उन दिशा-निर्देशों के तहत उठाया जा रहा है, जिसमें उन्होंने देशवासियों को पारदर्शी और साधारण तरीकों से पासपोर्ट सेवा देने की बात की थी। मालूम हो कि सरकार के पास पासपोर्ट के लिए पुलिस सत्यापन के संबंध में लगातार शिकायतें आती हैं और इसके चलते पासपोर्ट जारी करने में देरी होती है।
आइए जानते हैं कैसे करते हैं पासपोर्ट के लिए ऑनलाइन आवेदन-
स्टेप-1- पासपोर्ट सेवा पोर्टल पर खुद को रजिस्टर करें
सबसे पहले पासपोर्ट सेवा पोर्टल की वेबसाइट http://passportindia.gov.in/AppOnlineProject/welcomeLink पर जाकर खुद को रजिस्टर करें। इसके register now लिंक पर क्लिक करें।
स्टेप-2- लॉगिन करें
खुद को रजिस्टर करने के बाद आपको एक लॉगिन आई मिल जाएगी, जिसकी मदद से आप खुद को पासपोर्स सेवा पोर्टल की वेबसाइट http://passportindia.gov.in/AppOnlineProject/welcomeLink पर लॉगिन कर सकते हैं।
आगे की स्लाइड्स में जानें अन्य स्टेप्स-
नोट- तस्वीरों का प्रयोग सिर्फ प्रस्तुतिकरण के लिए किया गया है। सारी जानकारी पासपोर्ट सेवा ऑनलाइन पोर्टल की वेबसाइट से ली गई है।
स्टेप-3- विकल्प चुनें
इसमें लॉगिन करने के बाद आपको अप्लाई फॉर फ्रेश पासपोर्स (Apply For Fresh Passport) या री इश्यू ऑफ पासपोर्ट (Re-issue of Passport) में से किसी लिंक को चुनना होगा। जैसा कि यहां हम पहली बार पासपोर्ट के आवेदन की प्रक्रिया की बात कर रहे हैं तो इसके लिए अप्लाई फॉर फ्रेश पासपोर्ट (Apply For Fresh Passport) पर क्लिक करना होगा।
स्टेप-4- फॉर्म भरें
अप्लाई फॉर फ्रेश पासपोर्ट पर क्लिक करने के आपके सामने कई सारे फॉर्म आएंगे, जिनमें आपकी जानकारी मांगी जाएगी। इन सभी फॉर्म को सही से भरें। ध्यान रहे कि फॉर्म भरने में गलती न हो, क्योंकि एक बार पासपोर्ट की प्रक्रिया रिजेक्ट होने पर दोबारा पासपोर्ट के लिए आवेदन करने में समय लग जाता है, जिससे समय की बर्बादी होती है।
स्टेप-5- भुगतान और मिलने का समय निर्धारण
‘व्यू सेव्ड/सबमिटेड एप्लिकेशन्स’ (View Saved/Submitted Applications) स्क्रीन पर ‘पे एंड शेड्यूल अप्वाइंटमेंट’ (Pay and Schedule Appointment) लिंक पर क्लिक करें और अपना अप्वाइंटमेंट, यानी मिलने का समय बुक करें।
फॉर्म सबमिट करने के बाद आपके सामने एक विंडो खुलेगी जहां पर आपको पासपोर्ट बनवाने की राशि का भुगतान करना होता है। यह भुगतान आप क्रेडिट कार्ड, डेबिट कार्ड, इंटरनेट बैंकिंग या फिर एसबीआई बैंक के चालान से कर सकते हैं।
स्टेप-6- सारी प्रक्रिया पूरी होने के बाद प्रिंट एप्लिकेशन रिसीप्ट लिंक पर क्लिक करके एप्लिकेशन को प्रिंट करें। इसमें आपका एप्लिकेशन रेफेरेंस नंबर और अप्वाइंटमेंट नंबर होता है।
स्टेप-7- जहां पर भी आपका अप्वाइंटमेंट बुक किया गया है वहां के पासपोर्ट सेवा केन्द्र में अपने असली डॉक्युमेंट्स के साथ जाएं।

Make passport in 10 days

नई दि‍ल्‍ली. पासपोर्ट बनवाने के लिए ऑनलाइन आवेदन करने वालों के लिए अच्छी खबर है। अब सिर्फ 10 दिन में पासपोर्ट बन सकता है। इसके लिए ऑनलाइन आवेदन करना होगा और इसके लिए डॉक्युमेंट्स की लिस्टिंग करना भी जरूरी नहीं है। अपने डॉक्युमेंट्स आवदेक ऑनलाइन समिट कर सकता है। साथ ही, आइडेंटिटी प्रूफ और ऐड्रेस प्रूफ जैसे तमाम डॉक्युमेंट की जगह सिर्फ एक आधार कार्ड से भी काम हो सकता है। आवेदन करते ही आपको अगले 3 दिनों में अप्वॉइंटमेंट मिल जाएगा। पूरी प्रक्रिया होने के ठीक 7 दिन बाद आपका पासपोर्ट आपके हाथ में होगा। यानी कुल मिलाकर सिर्फ 10 दिनों में आपका पासपोर्ट आपके पास आ सकता है।
गाजियाबाद के पासपोर्ट अधिकारी सीताराम यादव का कहना है कि पहले प्रॉसेस में समय लगता था। इसलिए डॉक्युमेंटेशन के जरिए समय को बचाने की कोशिश की जा रही है। हालांकि, कभी-कभी डाक सेवा में देरी या छुट्टियों के चलते पासपोर्ट पहुंचने में ज्यादा समय लग जाता है।
आधार कार्ड का फायदा
सरकार ने आधार कार्ड की प्रक्रिया से आवेदक की आपराधिक गति‍वि‍धि‍यों के सत्यापन की प्रणाली बनाने की कोशिश की है। नई प्रक्रिया के तहत यदि कोई पासपोर्ट के लिए आवेदन करता है और उसके पास आधार कार्ड नहीं है, तो पहले उसे आधार कार्ड बनवाना पड़ सकता है।
क्यों होती थी देरी
दरअसल, सरकार के पास पासपोर्ट के लिए पुलिस सत्यापन के संबंध में लगातार शिकायतें आती हैं और इसके चलते पासपोर्ट जारी करने में देरी होती है। आवेदक को सुविधा देने के लिए मिनिस्ट्री ऑफ होम अफेयर्स ने यह निर्णय लिया है। हम आपको बता रहे हैं कि आवेदक किस तरह अपने पासपोर्ट के लिए ऑनलाइन आवेदन कर सकता है और सिर्फ 10 दिन में अपना पासपोर्ट हासिल कर सकता है।
आइये, जानते हैं क्या है पासपोर्ट के लिए ऑनलाइन आवेदन का प्रॉसेस…
स्टेप-1- पासपोर्ट सेवा पोर्टल पर खुद को रजिस्टर करें

सबसे पहले पासपोर्ट सेवा पोर्टल की वेबसाइट http://www.passportindia.gov.in/AppOnlineProject/welcomeLink पर जाएं। पेज पर register now के लिंक पर क्लिक करें। रजिस्टर करें। इसमें अपनी डिटेल्स भरें। इसके बाद आपको ई-मेल आईडी पर लॉगिन आईडी मिल जाएगी। वापस होम पेज पर जाएं।

स्टेप-2- लॉगिन करें
ई-मेल पर आए लिंक पर क्लिक करके अपने अकाउंट को एक्टिवेट करें। यूजर आईडी भरें और फिर पासवर्ड डालें। अप्लाई फॉर फ्रेश पासपोर्स (Apply For Fresh Passport) या री-इश्यू ऑफ पासपोर्ट लिंक पर क्लिक करें। इसके बाद दो पार्ट हैं। ऑनलाइन पासपोर्ट आवेदन करने के लिए दूसरे ऑप्शन पर क्लिक करें।

Learn HTML: Learn the Foundations of HTML

What Is HTML5?

HTML is a markup language that provides the structure that lies underneath every website—and many mobile apps. You can easily think of HTML as the framing that gives structure to content, but is nearly invisible to the naked eye. HTML stands for HyperText Markup Language. If the term HyperText is unfamiliar—as it is to many—it simply means interactive text. Hypertext is generally made interactive with hyperlinks, which we’ll discuss later on in the tutorial.

For many, learning HTML is a first step towards learning web design and development—or even more advanced programming languages. Most think HTML is clear and easy to learn. Perhaps many think HTML is easy to learn due to the fact that it’s a markup language, which is distinct from a programming language. A markup language is designed to describe the purpose of content pieces in a document.

A common misconception about HTML is that it is used to design a web page or web site. This simply isn’t true. While the HTML language provides structure, that structure is divorced from the actual appearance. The HTML structure can be applied to large-screen monitors, mobile devices and even the printed version of documents.image06

Figure 1: Some of the HTML that structures Udemy.com as viewed in the web browser. You can view the HTML from any site in your web browser by clicking View —> Source in the browser menu.

The actual graphic design of a web site is defined using a separate language called CSS, which stands for Cascading Style Sheet language. In this tutorial we’re going to use mostly HTML5 markup, but will also introduce some CSS so we can make our HTML5 content look better. Even if you don’t have any CSS defined in your document, the browser has default CSS for each HTML5 element. This is known as the default style sheet. The default style sheet styles each HTML element if no CSS is provided. The default styles tend to be very boring, but they do make plain HTML content appear readable in the browser.

Versions of HTML

There are a number of versions of HTML that are in use today. The most current version of HTML is HTML5. It was recently made the current recommendation of the World Wide Web Consortium (W3C), the standards body that governs HTML. (Without standardization and the W3C, every browser might interpret HTML differently, causing a different result in Chrome, Firefox and Safari.)

HTML5 has brought some much-needed standardization to the world of HTML. With HTML5 we can now play audio and video directly in the web browser. This latest version of HTML has brought us many new tags which have allowed us to better describe (or mark up) the content in our documents. For example, before HTML5 we only had (primarily) <p> (paragraph) tags and <h> (heading) tags to describe our content. HTML5 has brought a plethora of new tags to allow us to structure documents. These new tags include header, footer, article, section, aside and nav (for navigation elements).

Prior to HTML5, most developers were using HTML 4.03 or XHTML. HTML 4.03 was an important update over older previous versions of HTML. There are still a great many web sites running on the HTML 4.03 standard today. HTML 4.03 required a bit more verbiage in some places, and was more limited than the current HTML5 version. XHTML was a stricter version of the HTML standard that required code to be compliant with both the HTML and XML development standards.

The good news is there is no real reason to get too hung up on the different versions of HTML. They are all very similar, and the differences are really nuanced. If you are familiar with HTML5 and need to work with older HTML 4.03 code, you should be able to do so without issue.

image08

Figure 2: HTML5 has included many new tags to allow us to describe content well, including: header, footer, article, section and aside.

The Lingo: Tags, Elements, Content, Attributes and Values

HTML5 code can appear confusing at first. It’s important to understand the vocabulary behind HTML5 code, as it makes the code easier to understand and allows you to better communicate about HTML code with others. If you understand and can identify tags, content, attributes and values in HTML5 code, you’ll be well on your way to a better understanding of the code.

Tags and Elements

Tags are the essential building blocks of HTML. Tags are the individual content units that make up the HTML markup language. If you are following best practices, HTML tags are paired into an opening tag and a closing tag. Together an opening tag, closing tag and whatever appears in between are known as an element. Consider the HTML element below:

<p>Until the end of time</p>

In this element there are two tags: the opening and closing “p” tags, which is an abbreviation for paragraph tag. Collectively, the opening tag, the text “Until the end of time” and the closing tag are known as an element.

Opening tags are always placed in brackets like this:
<p>

Closing tags are always placed in brackets with a forward slash like this:
</p>

Elements can be considered the building blocks of HTML code, and tags are the building blocks of elements.

Content

In our element example above, the content of the element is the text “Until the end of time.” The content is most often what is actually being delivered for the user to read, listen to or view. All of the text you view in a browser is content that exists in some element of the HTML code. Element content can be broken down into three categories:

Text Content: Text content inside an element is often directly displayed to the user. Text can be a single sentence, an entire paragraph, or even an entire article. The following HTML element contains only text content:

<p>If you are strong enough, there are no precedents</p>

Element Content: Some elements contain one or more additional elements of content. Later in this tutorial, we’ll examine basic document structure, which uses a number of elements contained in other elements. For example, the <head> element below contains element content:


<head>
    <title>You rock the world</title>
    <meta type="author" description="Mark Lassoff" />
</head>

Empty Content: A few elements can be empty and contain no content at all. These elements are usually abbreviated and not closed with a formal closing tag. The break element, <br/>, is used with frequency and is empty. The “/” in the tag indicates that the tag is both an opening and closing tag.

Attributes and Values

Often tags need to be modified in some way or additional information is needed about how the tag should perform. Frequently, tags need to be linked to CSS or Javascript code in order to make them dynamic. In either of these cases, attributes and values are used. You might see some HTML code that is similar to this:


<p id="first">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas purus felis, finibus sed nunc et, dignissim placerat elit. Curabitur nec leo rhoncus, condimentum urna quis, dapibus sapien. Maecenas condimentum turpis id arcu rhoncus sodales. Vestibulum mattis varius ligula, sed venenatis lorem gravida ut. Donec interdum consectetur congue. Pellentesque tincidunt lobortis pretium. Donec urna urna, cursus eget nunc sit amet, vehicula mattis odio. Nam et venenatis tellus. Etiam at ligula lacinia, mattis nunc eget, condimentum nibh.</p>

If you examine the opening paragraph tag, you’ll notice the addition of an attribute and value. The attribute “id” allows us to assign an identifier to the element. (This is used if we want to address the element through Javascript or CSS code). The value is “first” which is the arbitrary value value I gave this element. There are no specific rules for providing values for id attributes; just be systematic and do what makes sense to you.

In older HTML you may see attributes and values designed to affect the appearance of the content in the browser. For example, you might see code similar to the following:

<p align="center">Tricks of the trade</p>

Be aware that while this is valid code, attributes that change the appearance of the content are no longer recommended for use in HTML5. Appearance is now within the purview of CSS, and this is code that should be updated.

Tools of the Trade

Every profession has “tools of the trade.” In the case of HTML, these are programs that you will use to write and display code. Note that the programs suggested here are merely the author’s recommendations; there are dozens of good tools out there. Most HTML coders discover their favorite tools through a process of trial and error. Try several tools and see which you like best.

The Text Editor

The text editor is the program where you will author your HTML5 code. Text editors are akin to stripped-down word processors. Most importantly, in contrast to word processors, they keep the text “pure” and don’t inject formatting codes that might confuse browsers trying to interpret HTML.

Asking a developer, “What’s the best text editor?” might be akin to starting a heated argument. Many developers are super passionate about their text editors.

A good free text editor is Brackets from Adobe. Brackets is available for PC and Mac, and you can download it for free.

image07

Figure 3: Brackets from Adobe is a free, popular text editor. Examples in this article were created using Brackets.

Your Browser

The browser landscape is always changing. Most developers have several browsers installed on their machine. The goal is often to make sure HTML and CSS code performs the same across that gamut of browsers. Google Chrome remains a favorite of many developers because of its extensive developer tools. Developers’ tools within Chrome provide a means of testing HTML and Javascript code and tracking down problems.

image10

Figure 4: Chrome Developer tools ready for action. These tools can be very helpful in debugging complex web sites.

In addition to Chrome, most web developers have Firefox, Safari and even Opera to test their HTML code. With many Windows users currently upgrading to Windows 10, users should consider testing in the Windows Edge browser, as well.

Your First HTML Document

Now’s the time to fire up your text editor and web browser and write some code. Commonly the first program that developers write when learning a new language is the “Hello World” program. This code displays the text “Hello World” in the browser. To honor the tradition, we’ll do the same here.

Writing the Code

Open your text editor and type the following code:


<!DOCTYPE html>
<html>
    <head>
        <title>First HTML document</title>
    </head>
    <body>
        <h1>Hello World</h1>
    </body>
</html>

Be careful as you key in the code, as a single error might cause the code to display improperly in the browser. Don’t worry much about the meaning of the elements; we’ll discuss those later. For now, just type in the code and get used to the process of writing code in a text editor and displaying it in a browser (which we’ll discuss next).

You’ll notice as you type the code that some lines are indented. This is done in an effort to make the code itself more readable and does not have any effect on how the code is displayed in the web browser. In fact, the browser completely ignores the indentation. The indentation does, however, make it easier for your human colleagues to read your code.

Using the save feature in your text editor saves the document as helloWorld.html. HTML documents you create should always use the .html extension.

Displaying the Result in a Web Browser

Loading the code into your web browser for testing should be as easy as double-clicking the icon for helloWorld.html. Hopefully you should get a result similar to the screenshot below:

image09

Figure 5: The Hello World displayed in Google’s Chrome browser.

If you aren’t greeted with “Hello World” in your browser window, open your text editor again and check your code carefully against the code provided for you.

HTML Document Structure

HTML documents all share a common structure. The structure provides a skeleton for all HTML documents. The structure looks like this:


<!DOCTYPE html>
<html>
    <head>
        <title></title>
    </head>
    <body>
        
    </body>
</html>  

You should note that the first line of code is not actually HTML code. The first line is known as a doc-type definition. Its purpose is to define the document as an HTML document. The doc-type definition shown is for HTML5 documents. The doc-type definition has been greatly simplified for HTML5. The doc-type definition for the older XHTML standard was much longer:


 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The doc-type definition also has no effect on the way a page is displayed; It is simply declarative, though it might be used by a validator to ensure that the code meets the HTML standard you have declared in the DOCTYPE element.

The basic document structure is generally broken into two parts: the head and the body.

The Document <head>

The document head generally contains three specific types of elements. First, the document <title> element defines a general title for the document. The title is used by search engines, like Google, to index the page. The title is also displayed in the document tab of the browser. Finally, the title is used if the user saves the page as a bookmark.

The second type of element is a “meta” tag. Meta tags provide further information about the document itself. For example, the meta tags may contain a description of the web site that is used by search engines.

image01

Figure 6: Some of the information in Google’s listing on Udemy was supplied by meta tags. Note the descriptions under each page header.

Finally, the third type of element contained in the document head are link elements that tie Javascript code and CSS code to the HTML document. Some complex HTML documents have ten or more link elements that include external scripts and libraries.

The Document <body>

Just about everything the user sees in the document window of the browser is contained in the <body> element of the HTML code. The body is, essentially, a container for the visible content on a page. The body is usually the longer section of the document and can contain an unlimited number of HTML elements.

The document body is where you will spend most of your time as a web developer. Most of the code that we’ll be working on in the rest of this tutorial will appear in the body element of the HTML script.

Displaying Text

The most basic task accomplished with HTML code is displaying text in the browser window. Our initial “Hello World” script displayed text in the browser window. As HTML coders, we actually have quite a bit of control over the text and how it appears in the browser. Let’s take a look at some of the HTML elements that are used to display text.

Headings

Most documents (including this one) have some kind of structure that includes various levels of headings and subheadings. HTML5 documents represent headings in six different levels of importance. The most important headings are marked with the <h1> tag. The secondary headings are marked with <h2>. The least important headings are marked with <h6> (though few documents have a structure that includes six levels of headings).

Consider the following code:


<!DOCTYPE html>
<html>
    <head>
        <title>Headings</title>
    </head>
    <body>
        <h1>This is heading one.</h1>
        <h2>This is heading two.</h2>
        <h3>This is heading three.</h3>
        <h4>This is heading four.</h4>
        <h5>This is heading five.</h5>
        <h6>This is heading six.</h6>
    </body>
</html>

This document displays all six levels of HTML headings. Displayed in a browser, the result should look something like this:

image00

Figure 7: Heading tags rendered in the browser.

Note that by default, the browser displays more important headings as bigger and bolder. However, don’t think of the heading tags as a way to make text bigger; appearance is within the purview of CSS code. It is best to think of heading tags as simply denoting the importance of an individual heading.

<p>aragraph Text

Arguably, the <p>aragraph tag is the most commonly used HTML tag. It is designed to hold a paragraph of text, though it is used by most developers as a generic element that can hold just about anything. Before HTML5 there weren’t too many other options to hold content, so the <p>aragraph tag became a de facto default. In contemporary HTML5 code, however, there exists a plethora of more specific tags that can be used to mark up content. The <p>aragraph tag is still frequently used, but should more or less only be used to demarcate paragraphs within a larger passage of text.

Articles, Details and More

As alluded too earlier, HTML5 introduced a number of new tags used to mark up text. The most popular of these appear below:

Tag Purpose
<article> Defines an article within a document
<aside> A content aside—secondary from the main content
<details> Used to provide additional details that the user can view or hide in most browsers
<figcaption> Defines the caption for a <figure> element
<figure> Self-contained elements like code listings, images, diagrams, animations, etc.
<footer> Defines the footer for the document
<header> Defines a header for the document
<main> Defines the primary content of a document
<nav> Defines the navigation components of an HTML document
<section> Creates a section in a document
<summary> Creates a summary of a document, article or other entity

These tags are meant to allow a document to be more accurately structured. Simply speaking, you should surround your content with whatever tag most accurately denotes the purpose of the content. Some of this can be open to interpretation; however, as long as elements within the document are consistently named, it shouldn’t be difficult to derive meaning from your HTML5 markup.

Typography with CSS

As mentioned earlier, HTML5 is a structural language. It is designed to structure a document and define content elements. HTML5 is not a design language; CSS (Cascading Style Sheets) is the language of design. CSS has a different syntax than HTML, but it is easily deciphered. Below is a typical CSS “rule”.


p {
    font-family: arial, sans-serif;
    font-size: 1.1em;
    color:  red;
}

The “p” in the CSS code above is known as the selector. It allows you to choose which elements the CSS will be applied to. In this case, the CSS styles will be applied to all paragraph elements within the document.

We’ve included three styles to be applied. The first “font-family” style sets the typeface to Arial, or if Arial is not available, any sans-serif font. The next style sets the font size to 110% of the default. The “em” measurement allows the designer to set the font size based on the user’s choice for default size. Multiple the value by 100 to get the percentage of default size. Values greater than one will increase font size. Values less than one will decrease font size. The final CSS style will simply turn the text red.

CSS must be expressed within a style element. Examine the code below:


<!DOCTYPE html>
<html>
    <head>
        <title>First CSS</title>
        <style>
            h1  {
                font-family: Arial, sans-serif;
                font-size: 4em;
                color: red;
            }
        </style>
    </head>
    <body>
       <h1>Hello World</h1>
    </body>
</html>

The result in the browser should appear similar to the screenshot below:

image03

Figure 8: With CSS applied. Note that the text is three times larger than normal, red and rendered in the Arial font.

There are dozens of style rules that can be applied with CSS. Everything from element spacing, to color, to appearance can be controlled with CSS.

This table contains a list of common CSS styles:

Style Possible Values Used with Elements
color #RRGGBB (Red, Green, Blue hex values) any element that contains text
text-align left | right | center | justify block elements h1- h6, p, li, etc.
text-decoration none | underline | overline | line-through | blink | inherit mostly with a (anchor) elements
text-transformation none | capitalize | uppercase | lowercase any element that contains text
line-height % or px block elements h1- h6, p, li, etc.
letter-spacing normal or px value any element that contains text
font-family font or font-family [, font or font-family …] any element that contains text
font-size px or em value any element that contains text
font-style normal | italic | oblique any element that contains text
font-weight normal | bold any element that contains text
background-color #RRGGBB (Red, Green, Blue hex values) any element with a background
background-image url(“[image url]”) mostly with body
background-repeat repeat | repeat-x | repeat-y | no-repeat mostly with body
background-position left | center | right | top | center | bottom mostly with body
list-style-type disc | square | circle ul
list-style-type decimal | lower-roman | upper-roman | lower-alpha | upper-alpha ol

Displaying Media

One of the major advances in HTML5 is the way media is handled. Audio and video media, for example, are now played directly by the browser instead of via a plugin like Flash. This, in part, has led to a proliferation of audio and video content on the web. The inclusion of images, audio and video is fairly easy with HTML5, as you’ll see in the code samples below.

Displaying Images

The way we display static images in a web browser hasn’t changed much in 20 years. There are three file formats that the browser can display: jpg, gif and png. It is preferable to use correctly optimized images that have a minimal file size. Images can be optimized in any graphics editing program like Photoshop. Even though Internet users enjoy more bandwidth than ever before, it is still preferable to optimize images for a minimal file size. This is especially helpful for users who may be trying to access content from a tenuous cellular connection.

The HTML code to display an image looks like this:

<img src="mark.jpg" />

The value of the src attribute is the path and file name of the image. In the example above, the image “mark.jpg” is in the same folder at the HTML file itself, so no path is necessary. Many developers recommend that you include an alt attribute in your image tag. This attribute lets you write a text description of the image, which is helpful to users who might be using a screen reader due to visual impairment.

Audio and Video

Adding audio and video to an HTML document has become much easier over the past few years. Now, all browsers tend to support major audio and video file formats. Just a few years ago, support was more fractured and you couldn’t depend on a specific audio or video file type to work across the gamut of browsers.

The following HTML script plays an audio file called music.mp3.


<!DOCTYPE html>
<html>
    <head>
        <title>Audio</title>
    </head>
    <body>
        <h1>Listen to the Music!</h1>
        <audio controls="controls">
            <source src="music.mp3" />
        </audio>
    </body>
</html>

Every browser has a built-in audio player. While functionally identical, they appear a bit different from browser to browser. The audio tag loads that player. By using the controls attribute, we make controls like play and volume visible to, and adjustable by, the user.

Loaded into the Chrome browser, the audio tag would render a player similar to the screenshot below:

image02

Figure 9: The audio player in Google’s Chrome browser.

To play video with HTML, the code is almost identical. If you have a video file, you can substitute the file name and the video tag for the audio tag.

The following code would play a video with the file name “video.mp4”:


<!DOCTYPE html>
<html>
    <head>
        <title>video</title>
    </head>
    <body>
        <h1>Watch the movie!</h1>
        <video controls="controls">
            <source src="video.mp4" />
        </video>
    </body>
</html>

Browsers have a built-in video player, as well. The following screenshot shows a video being rendered in the Chrome browser:

image05

Figure 10: A sample .mp4 video rendered in the Chrome Browser. Note the video controls superimposed at the bottom of the video.

Hyperlinks

If there is a single advancement that caused the web to explode twenty years ago, it just might be hyperlinks. Hyperlinks give us the ability to jump from one document to another at the click of a mouse. Hyperlinks allowed us to create complex, hierarchical documents that were navigable and dynamic.

Hyperlinks are so common that most developers take them for granted. Hyperlinks—commonly abbreviated as links—fall into two broad categories. External links go from your page to a totally different web site. The second category of links, internal links, select a different page on the current site.

Links can be produced from text or image elements on a page. If you’ve worked with a web interface that included “buttons”, these were likely links. We’ll produce links with the <a>nchor tag.
External Links
External links go from your site to another site on a different domain. For example, if you were linking your site to Udemy.com or CNN.com, these would be external links. For example, my HTML course on Udemy is located at https://www.udemy.com/learn-html5/learn. If I wanted to link to that site, I’d write the following HTML:

<a href="https://www.udemy.com/learn-html5/learn">Learn HTML on Udemy!</a>

There are two components for us to look at in the hyperlink. The first is the text the user will click on in order to activate the link. This text is placed between the opening <a>nchor tag and the closing <a>nchor tag. In the preceding example, “Learn HTML on Udemy!” would be displayed for the user to click.

The second component to examine in a link is the address where you want the user to go on the web when the link is clicked. In the preceding example, we are using the Udemy address that takes the user to the HTML course.

Internal Links

Internal links are not much different from external links, except for the fact that they take the user to another page within the same domain. Imagine moving from the stock listings to the weather on a news site or one course to another on Udemy. These types of moves are accomplished via internal links. Internal links are structurally the same as external links. Let’s say, for example, you had the following two files:


<!DOCTYPE html>
<html>
    <head>
        <title>Links</title>
    </head>
    <body>
        <p>This is page one.</p>
        <p>Would you like to see <a href="page2.html">page two</a>?</p>
    </body>
</html>

page1.html


<!DOCTYPE html>
<html>
    <head>
        <title>Links</title>
    </head>
    <body>
        <p>This is page two.</p>
        <p>Would you like to see <a href="page1.html">page one</a>?</p>
    </body>
</html>

page2.html

You’ll note that the value of the href attribute here does not include the http:// section. Both page1.html and page2.html are on the same domain, and therefore the http:// is not necessary. Again, the words the user will click to activate the link are between the opening and closing <a>nchor tags, and the links work when clicked in the web browser.

image04

Figure 11: The link to page two is displayed in the web browser.

Conclusion

This primer on HTML was designed to give you a quick start in HTML coding. There is much more to learn and to know before you have HTML coding mastered. I hope this tutorial gave you a good introduction to the art of HTML code. Good luck with your future scripts!