MoonPoint Support Logo

 


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
January
Sun Mon Tue Wed Thu Fri Sat
 
16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
2018
Months
JanFeb Mar
Apr May Jun
Jul Aug Sep
Oct Nov Dec


Mon, Jun 19, 2017 9:39 pm

Wrapping text on a webpage

I query an SQLite database using PHP code on a webpage. One of the fields in the database is a "Note" field, where notes have been entered without any HTML code to format the text. When I display the notes on a webpage, I want to preserve the line breaks and paragraphs as they were typed. Since there are no <br> line break nor <p> paragraph tags on the page, I could display the text as typed using the pre tag, but the problem with just using that tag is that in cases where the a line is very long, someone would have to scroll far to the right to see the entire line on the webpage, if I just used the pre tag. However, I can specify a style for the pre tag that will result in the text wrapping at the right-edge of the browser window. E.g. <pre style="white-space: pre-wrap"> . Or, if I don't want the text displayed in the monospaced default font for the pre tag, I can apply the style to the <div> tag, instead. E.g.: <div style="white-space: pre-wrap">.

[ More Info ]

[/network/web/html] permanent link

Sun, May 07, 2017 6:09 pm

Centering an image on a webpage horizontally

To center an image horizontally on a webpage, you can add style="display: block; margin: auto;" to the img tag. E.g.

<p> <img src="320px-Fisher_500_radio.jpg" alt="Fisher AM/FM radio from 1959" width="320" height="208" style="display: block; margin: auto;"> </p>

Fisher AM/FM radio from 1959

Related articles:

  1. Centering a div and an image within it using CSS

[/network/web/html/css] permanent link

Sat, Apr 22, 2017 11:20 pm

Vertically aligning an image with text using CSS

If you wish to vertically align an image with text in Hypertext Markup Language (HTML) code that is compliant with Cascading Style Sheets (CSS) you can do so using <style="vertical-align: position;"> where position is bottom, middle, or top. E.g., if I want to align an image of the direct current symbol, which is a horizontal line over top of three shorter horizontal lines, so that the image is vertically in the middle of the text, I could use the code below:

24V <img src="direct-current.gif" width="49" height="49" style="border: none; vertical-align: middle;" alt="Direct current symbol">1500mA

I would then see the following:

24V Direct current 
symbol1500mA

If I used vertical-align: top, instead, the image would appear as shown below where the text is aligned with the top of the image:

24V Direct current 
symbol1500mA

If I used vertical-align: bottom, instead, the image would appear as shown below:

24V Direct current 
symbol1500mA

If I did not specify a vertical alignment, the image would appear as it did when I specified "bottom" for the vertical alignment as shown below:

24V Direct current symbol1500mA

Though, in this case I could also have used the HTML code &#9107;, instead, for the direct current symbol and avoided the use of an image and the need to align the image with the text, though I didn't realize that when I started using the image on a page for power adapter for various devices.

E.g.: 24V ⎓ 1500mA

[/network/web/html/css] permanent link

Sat, Mar 04, 2017 10:00 pm

CSS max-width and min-width for @media

The third specification of the Cascading Style Sheets (CSS) style sheet language, CSS 3 provides support for media queries, which can adjust the display of information in a browser based on screen resolution, e.g. smartphone screen vs. computer screen, the width of the browser viewport, etc. This is done through the use of "@media, which can be used in a style sheet or a style element included in the <head> section of the HTML code.

Two parameters that can be used with @media are shown below:

max-widthThe maximum width of the display area, such as a browser window
min-widthThe minimum width of the display area, such as a browser window

[ More Info ]

[/network/web/html/css] permanent link

Tue, Jan 03, 2017 10:23 pm

Executing a JavaScript function when a browser window is resized

Sometimes you may want to have a certain event take place if a visitor to your website resizes his or her browser window. With HTML 5, you can use the onresize Event Attribute. You can apply the event attribute to the body tag, e.g.:

<body onresize="someFunction()">

The event that would occur when the browser window is resized will depend upon the code you place in the JavaScript function referenced, which in this case I've named someFunction.

Note: the onresize attribute is new to HTML5 and isn't supported in HTML 4.01 and older versions oF HTML. You can expect current versions of browsers to support it, but if a visitor has an outdated browser version, the function may not work for the visistor.

[ More Info ]

[/network/web/html] permanent link

Sat, Oct 01, 2016 10:21 pm

Align attribute is obsolete

With HTML 4, you can horizontally align an element in a cell in a table using the align parameter, e.g.: <td align="right"> to horizontally align text to the right side of a cell. However, with HTML5, use of the align parameter for horizontally aligning text within elements of a table has been deprecated. E.g., if you check your HTML code for adherence to the HTML 5 standard with the Nu Html Checker provided by the World Wide Web Consortium, you will see an error similar to the following one displayed if you are using align in the HTML code for a table.

The align attribute on the td element is obsolete. Use CSS instead.
From line 118, column 5; to line 118, column 22
</tr>↩<tr><td align="right">;<b>Vir

[ More Info ]

[/network/web/html/css] permanent link

Wed, Sep 28, 2016 10:55 pm

Centering a table with CSS

With HTML 4, you could center a table using align="center".

<table align="center">
...
</table>

However, that method of centering a table is deprecated in HTML5. To center a table, which is a block-level element, in HTML5 using a Cascading Style Sheets method, you can use a style that includes margin-left: auto; margin-right: auto; as shown below.

<table style="margin-left: auto; margin-right: auto;">
...
</table>

[ More Info ]

[/network/web/html/css] permanent link

Sun, Sep 18, 2016 10:12 pm

Align attribute on the paragraph element is obsolete

With HTML 4, you can horizontally center an image in a paragraph using <p align="center">. E.g., the image in the following paragraph would be cenered on the web page:

<p align="center">
<img src="f2a046-10-gld_320x240.jpg" alt="F2A046-10-GLD Printer Cable" width="320" height="240">
</p>

However, with HTML5, use of the align parameter for horizontally aligning a paragraph on a web page has been deprecated. E.g., if you check your HTML code for adherence to the HTML 5 standard with the Nu Html Checker provided by the World Wide Web Consortium, you will see an error similar to the following one displayed if you are using align with the p (paragraph) tag.

The align attribute on the p element is obsolete. Use CSS instead.
From line 73, column 1; to line 73, column 18
tent -->↩↩<p align="center">↩<img src

[ More Info ]

[/network/web/html/css] permanent link

Sun, Jul 24, 2016 6:33 pm

HTML attributes obsoleted by HTML5

There are quite a few HTML attributes made obsolete in HTML5, which is the current HTML standard. I've been trying to make new web pages on my site compliant with version 5 of the standard and transitioning some created using HTML 4.1 to HTML5, so I've had to modify the HTML code to use other tags or eliminate the use of attributes that have been deprecated with HTML5. Some of the elements and attributes that have been deprecated are listed below:
  1. cellpadding attribute
  2. frameborder attribute on the iframe element
  3. scrolling attribute on the iframe element
  4. name attribute
  5. valign attribute
  6. tt element

[/network/web/html/css] permanent link

Sun, Mar 27, 2016 9:02 pm

Setting the padding and border for a table with CSS

With HTML 4, you can stipulate that a border be placed around the cells in a table using the border parameter, e.g.: <table border="1">. However with HTML5, use of the "border=" attribute for putting a border around elements of a table has been deprecated as has setting the padding around elements in a table with cellpadding, e.g., <table border="1" cellpadding="3">. If you check your HTML code for adherence to the HTML 5 standard with the Nu Html Checker provided by the World Wide Web Consortium, you will see an warning displayed if you have used the border attribute and an error displayed for use of the cellpadding attribute. You can achieve an equivalent table display using Cascading Style Sheets, however, by adding a style section for the table and the th and td elements to set the border and setting cell padding in a style section or for each td and th element

[/network/web/html/css] permanent link

Once You Know, You Newegg AliExpress by Alibaba.com

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo