revision:
The <b> tag specifies bold text without any extra importance. It is used to make a portion of the text bold without carrying any special importance. According to the HTML5 specification, the <b> tag should be used as a LAST resort when no other tag is more appropriate. The specification states that headings should be denoted with the <h1> to <h6> tags, emphasized text should be denoted with the <em> tag, important text should be denoted with the <strong> tag, and marked/highlighted text should be denoted with the <mark> tag. <b> tags should be used to bring attention to a span of text without increased importance.
The iPhone 5s edged out the Samsung Galaxy S4 slightly in all of our tests, however we recommend buying both.
code: <p class="spec">The <b>iPhone 5s</b> edged out the <b>Samsung Galaxy S4</b> slightly in all of our tests, however we recommend buying both.</p>
The two most popular science courses offered by the school are chemistry (the study of chemicals and the composition of substances) and physics (the study of the nature and properties of matter and energy).
code: <p class="spec">The two most popular science courses offered by the school are <b class="term">chemistry</b> (the study of chemicals and the composition of substances) and <b class="term">physics</b> (the study of the nature and properties of matter and energy).</p>
This article describes several text-level elements. It explains their usage in an HTML document.
Keywords are displayed with the default style of the element, likely in bold.
code: <p class="spec">This article describes several <b class="keywords">text-level</b> elements. It explains their usage in an <b class="keywords">HTML</b> document.</p> <p class="spec">Keywords are displayed with the default style of the <b>element, likely in bold.</b></p>
example
Use the <b> tag to create bold text on your pages.
code: <p class="spec">Use the <b> tag to create <b>bold text</b> on your pages.</p>
We want to bold this text.
code: <p class="spec">We want to bold <b>this text</b>.</p>
The <base> tag specifies the base URL and/or target for all relative URLs in a document. The <base> tag must have either an "href" or a "target" attribute present, or both. There can only be one single <base> element in a document, and it must be inside the <head> element. If multiple <base> elements are used, only the first "href" and first "target" are obeyed — all others are ignored.
href ; value: url; the base URL to be used throughout the document for relative URLs. Absolute and relative URLs are allowed. When creating an anchor link, the "href attribute" can specify an absolute URL - like "http://example.com" - or a relative URL - such as "/", "/page-name", or "page-name". With relative URLs a slash ( / ) indicates the root URL of the current page. So, href="/page-name" would link to a page at currentdomain/page-name. Leaving off the slash links to a subpage of the current URL, so href="page-name" would link to current_url/page-name. Using the <base> element, you can change the base URL which the relative links on the page use. Instead of the current, actual URL of the current page, all relative links will be based on the URL specified in the href attribute of the <base> element.
target ; value: _blank, _parent, _self, _top; specifies the default target for all hyperlinks and forms in the page. If you set target="_blank" in the <base> element, all links on the page (relative and absolute) will open in a new window, unless otherwise specified.
This element must not contain any content, and does not need a closing tag.
- notice that we have only specified a relative address for the image. Since we have specified a base URL in the head section, the browser will look for the image at "https://www.lwitters.com/tutorials/pics/1.jpg".
HTML object tag - notice that the link opens in a new window, even if it has no target="_blank" attribute. This is because the target attribute of the base element is set to "_blank".
P.S. The base URL in the head section has been disabled due to the presence of the href attribute in the "content section".
HTML:
example
link to HTML basics pageBDI stands for Bi-Directional Isolation. The <bdi> tag isolates a part of text that might be formatted in a different direction from other text outside it. This element is useful when embedding user-generated content with an unknown text direction. The "bdi" tag does not physically turn the text, it only tells the browser that it should read the text in the opposite direction.
The "bdi" tag is used to isolate a bidirectional text when a language with right-to-left directionality (such as Arabic or Hebrew) is used in line with left-to-right languages
BDO stands for Bi-Directional Override. The "bdo" tag is used to override the current text direction. The required "dir" attribute specifies the text direction of the text inside a "bdo" element. Syntax: <bdo dir="ltr | rtl"></bdo>
The "bdi" tag is similar to the older "bdo" tag. The "bdi" element isolates the contained text from the text around it, whereas "bdo" just reverses the direction. It is generally recommended to use "bdi" to prevent unexpected rendering problems that can arise with "bdo> .
Leader board:
code: <div> <p class="example">Leader board: </p> <ul class="example"> <li><bdi>John S. </bdi>: 100 Percent. <li>User<bdi>Fred T. </bdi>: 93 Percent. <li>User<bdi>إيان</bdi>: 91 Percent. <li>User<bdi>Julie R. </bdi>: 89 Percent. </ul> </div>
This paragraph will go left-to-right.
This paragraph will go right-to-left.
code: <div> <p class="example">This paragraph will go left-to-right.</p> <p class="example"><bdo dir="rtl">This paragraph will go right-to-left.</bdo></p> </div>
Using a simple string of text: "abcdefghijklmnopqrstuvwxyz"
Here is what it looks like with bdo dir="ltr": abcdefghijklmnopqrstuvwxyz
Here is what it looks like with bdo dir="rtl": abcdefghijklmnopqrstuvwxyz
code: <div> <p class="example">Using a simple string of text: "abcdefghijklmnopqrstuvwxyz"</p> <p class="example">Here is what it looks like with bdo dir="ltr": <bdo dir="ltr">abcdefghijklmnopqrstuvwxyz</bdo></p> <p class="example">Here is what it looks like with bdo dir="rtl": <bdo dir="rtl">abcdefghijklmnopqrstuvwxyz</bdo></p> </div>
أرمينيا جميلة This sentence in Arabic is automatically displayed from right to left.
code: <p class="example" dir="ltr"><bdi>أرمينيا جميلة</bdi> This sentence in Arabic is automatically displayed from right to left.</p>
The <blockquote> tag specifies a section that is quoted from another source. Browsers usually indent <blockquote> elements. The <blockquote> HTML element indicates that the enclosed text is an extended quotation. Usually, this is rendered visually by indentation. A URL for the source of the quotation may be given using the "cite attribute", while a text representation of the source can be given using the <cite> element.
Here is a quote from WWF's website:
For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.
Codes:
<p class="spec">Here is a quote from WWF's website:</p> <blockquote style="margin-left:3vw;" cite="http://www.worldwildlife.org/who/index.html"> For 50 years, WWF has been protecting the future of nature. The world's leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally. </blockquote>
Codes:
<style> blockquote {margin: 0;} blockquote p {padding: 15px; background: #eee; border-radius: 5px;} blockquote p::before {content: '\201C';} blockquote p::after {content: '\201D';} </style> <div> <figure style="margin-left:3vw;"> <blockquote cite="https://www.huxley.net/bnw/four.html"> <p class="spec">Words can be like X-rays, if you use them properly—they’ll go through anything. You read and you’re pierced.</p> </blockquote> <figcaption>—Aldous Huxley, <cite>Brave New World</cite></figcaption> </figure> </div>
The <body> tag defines the document's body. The <body> element contains all the contents of an HTML document, such as headings, paragraphs, images, hyperlinks, tables, lists, etc. There can only be one <body> element in an HTML document. The <body> element contains the entire content of a webpage. It must be the second element inside of the parent <html> element, following only the <head> element.
onload : function call on page loading.
onunload : function call when user leaves the page.
onfocus : function call when document receives focus by user.
onblur : function call when document loses focus by user.
Codes:
<body> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body>
The <br> HTML element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant. The <br> element has a single, well-defined purpose — to create a line break in a block of text. As such, it has no dimensions or visual output of its own, and there is very little you can do to style it.
It is an empty tag, which means it does not need the company of end tag. If you place the tag in the HTML code, then it works the same as pressing the enter key in a word processor.
example
O'er all the hilltops
Is quiet now,
In all the treetops
Hearest thou
Hardly a breath;
The birds are asleep in the trees:
Wait, soon like these
Thou too shalt rest.
Codes:
<p class="spec"> O'er all the hilltops<br> Is quiet now,<br> In all the treetops<br> Hearest thou<br> Hardly a breath;<br> The birds are asleep in the trees:<br> Wait, soon like these<br> Thou too shalt rest. </p>
If you want to break a line
in a paragraph,
use the BR element in
your HTML document.
Codes:
<p class="spec">If you want to break a line <br> in a paragraph, <br> use the BR element in <br> your HTML document. </p>
The <button> tag defines a clickable button. Inside a <button> element you can put text (and tags like <i>, <b>, <strong>, <br>, <img>, etc.). That is not possible with a button created with the <input> element!
Buttons can be easily styled with CSS! Tip: always specify the "type" attribute for a <button> element, to tell browsers what type of button it is.
autofocus ; value:autofocus; specifies that a button should automatically get focus when the page loads.
disabled ; value: disabled; specifies that a button should be disabled.
form ; value: form_id; specifies which form the button belongs to.
formaction ; value: URL; specifies where to send the form-data when a form is submitted. Only for type="submit".
formenctype ; value: application/x-www-form-urlencoded, multipart/form-data, text/plain; specifies how form-data should be encoded before sending it to a server. Only for type="submit".
formmethod ; value: get, post; specifies how to send the form-data (which HTTP method to use). Only for type="submit".
formnovalidate ; value: formnovalidate; specifies that the form-data should not be validated on submission. Only for type="submit".
formtarget ; value: _blank, _self, _parent, _top, framename; specifies where to display the response after submitting the form. Only for type="submit".
name ; value: name; specifies a name for the button.
value ; value: text; specifies an initial value for the button.
code: <button type = "button" onclick = "alert('Welcome to my website')">Click Here</button>
code: <form class="example" action="https://www.lwitters.com/" target="_blank"> <button type="submit">my website</button> </form>
coding: <button type="submit" formaction="https://www.lwitters.com/">My website</button>
The button disabled attribute
code: <p class="example">The button disabled attribute</p> <button class="example" type="button" disabled>Click Me!</button>
code: <div class="spec"> <button class="button button1" type="button">Green</button> <button class="button button2" type="button">Blue</button> <button style="font-size: 1vw;" type="button">I am a blue button! Click me!</button> <button style="font-size: 1vw;" type="button" onclick="alert('Hi user!')">Press me!</button> <p>This button transfers you to another website!</p> <a href="http://lwitters.com" target="_blank"> <button class="example" type="submit" style="font-size: 1vw;">Click me!</button> </a> </div>
code: <div class="tags spec"> <p>autofocus: <button type="button" autofocus>Hello World!</button></p> <p>disabled: <button type="submit" disabled>Register</button></p> <p>form: <form action="http://google.com" method="GET" id="Search"> Search term: <input type="text" name="search_query"></form><button type="submit" form="search">search</button></p> <p>formaction<form><button type="submit" formaction="https://lwitters.com"> Click me</button></form></p> </div>
Click to disable the button element:
code: <div> <p>Click to disable the button element:</p> <button class="example" type="button" id="myBtn" onclick="disable()">Try it</button> <p class="example" id="one"></p> </div> <script> function disable() { var x = document.getElementById("myBtn"); x.disabled = true; } </script>
Click the "Try it" button to create a button element with a "Click me" text. (see bottom of the page)
code:<button style="width: 10vw; height: 2vw;"" class="example" type="button" onclick="createButton()">Try it</button> <p id="AA"></p> </div> <script> function createButton() { var x = document.createElement("BUTTON"); var t = document.createTextNode("Click me"); x.appendChild(t); document.getElementById("AA").appendChild(x); } </script>
example
Click the button to display the time.
Copy text from Field1 into Field2.
Field1:
Field2:
code: <div> <button class="example" onclick="getElementById('two').innerHTML=Date()"> What is the time?</button> <p class="example" id="two"></p> <p>Copy text from Field1 into Field2.</p> <p class="spec">Field1:<input class="example" type="text" id="field1" value="Hello World!"></p><br> <p class="spec">Field2: <input class="example" type="text" id="field2"></p><br> <button class="example" onclick="copyText()">Copy Text</button> </div> <script> function copyText() { document.getElementById("field2").value = document.getElementById("field1").value; } </script>
example
Use JavaScript to change the status of the button
code: <div> <input class="example input" type="text" placeholder="Insert your text" /> <button class="button">Submit</button> </div> <script> let input = document.querySelector(".input") let button = document.querySelector('.button') button.disabled = true input.addEventListener("change", swapState) function swapState(){ if (document.querySelector(".input").value === ""){ button.disabled = true } else { button.disabled = false } } </script>