MoonPoint Support Logo

 

Click here for the Best Buy Weekly Specials
Mother's Day is May 12. We've Got Gifts to Make Mom's Day, Plus Free Shipping. 1 x 1 px



Advanced Search
May
Sun Mon Tue Wed Thu Fri Sat
     
18
19 20 21 22 23 24 25
26 27 28 29 30 31  
2013
Months
MayJun
Jul Aug Sep
Oct Nov Dec


Mon, Jan 16, 2012 12:59 pm

Floating Left and Right Columns Within a Div

I wanted to have two columns on one section of a web page where the fist column was all left-aligned on the page, but the second column was aligned to the right of the page.

I used the DIV tag to create the two columns. I used <div style="float: left;"> for the left columan and <div style="float: right;"> for the right column. I enclosed both of them in an outer DIV. Since I wanted to have a top margin of 75 pixels for the outer DIV to separate it from the material above, I used <div style="margin-top: 75px;"> for it. But when I viewed the page, the material in the two columns wasn't appearing the way I wanted it to appear. I then tried adding overflow: auto to the outer DIV as shown below.

<div style="margin-top: 75px; overflow: auto;">

<div style="float: left;">
Stuff in left column
</div>

<div style="float: right;">
Stuff in right column
</div>

</div>

<p>Stuff below</p>

That looked fine when viewed in Firefox, but Internet Explorer showed the "stuff below" between the two columns.

I was able to resolve the problem by inserting a complete "cleared" element last in the container as explained at How To Clear Floats Without Structural Markup By adding another DIV below the two column DIVs but within the outer DIV, I was able to get the results I wanted in both Internet Explorer and Firefox. That DIV was just <div style="clear: both;"></div>.

So I then had the following HTML code for the page.

<div style="margin-top: 75px; overflow: auto;">

<div style="float: left;">
Stuff in left column
</div>

<div style="float: right;">
Stuff in right column
</div>

<div style="clear: both;"></div>

</div>

<p>Stuff below</p>

References:

  1. 2 Column Div float right and left child divs outside parent
    Date: August 31, 2010
    Stack Overflow
  2. How To Clear Floats Without Structural Markup
    By: Big John
    Created May 14, 2004
    Last updated: July 2, 2008
    Position Is Everything

[/network/web/html] permanent link

Sat, Oct 01, 2011 8:20 pm

JavaScript and Cascading (CSS) Style Sheets

Cascading Style Sheets are the dominant style sheet language used now for enhancing the formatting and layout of HTML web pages, but there was also a shortlived alternative known as JavaScript Style Sheets (JSS) or (JSSS).

CSS provides adds additional capabilities for controlling the appearance of web pages and provides a mechanism for separating webpage content from web page design to allow a uniform look for webpages throughout a site.

[ More Info ]

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

Sun, Mar 27, 2011 5:08 pm

Validating HTML and CSS

If you wish to validate the HTML code on a webpage you can use the W3C Markup Validation Service. If you wish to validate a Cascading Style Sheet for a page, you can use the W3C CSS Validation Service.

[/network/web/html] permanent link

Tue, Jan 05, 2010 9:52 pm

Displaying Additional Text When Mouse Hovered Over Text

A simple way to display additional text when someone moves his/her mouse over text on a webpage, is to use something like the following:

<a title="Text to be displayed on mouse hover">Some text<a>

Which will produce the following:

Some text.

References:

  1. Show text on Hover
    Date: September 22, 2005
    newsgroups.derkeiler.com: The source for newsgroups news

[/network/web/html] permanent link

Sat, Sep 26, 2009 5:50 pm

HR Tag Within Pre Tag

When I checked a webpage for HTML errors using the W3Creg; Markup Validation Service, I saw errors such as the following reported:

Error Line 165, Column 4: document type does not allow element "HR" here; missing one of "MAP", "IFRAME", "BUTTON" start-tag

<hr>

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

The problem occurred because I had placed <hr> between <pre> and </pre> tags. I had something like the following:

<pre>
This is some text
<hr>
This is some more text
</pre>

I eliminated the error by placing a end pre tag after the first block of text and a begin pre tag before the second block of text.

<pre>
This is some text
</pre>
<hr>
<pre>
This is some more text
</pre>

References:

  1. CSS - html/css validation error
    Date: 2008-02-25
    Ultrashock Forums

[/network/web/html] permanent link

Tue, Apr 28, 2009 8:01 pm

Double Underline in HTML

I wanted to put a double underline under "Windows XP Professional Setup" on a webpage. I needed the text in that section of the page to be white on a blue background. To achieve that effect, I used <u style="border-bottom: solid 1px;">Windows XP Professional Setup<u>. The HTML code is shown below.
<div style="background-color: blue; color: white; width: 640px; padding: 2px;">
<pre>
<u style="border-bottom: solid 1px;">Windows XP Professional Setup</u>


</pre></div>

The code would produce the following:

Windows XP Professional Setup


References:

  1. How do you make a double underline???
    Date: December 11, 2006
    Forums - CreateBlog

[/network/web/html] permanent link

Tue, Apr 14, 2009 7:57 am

Character Encoding of Webpages

I've been validating the HTML code on the webpages I create for a few weeks using the W3C Markup Validation Service. For all of my webpages, I've been getting the warning below when I validate them:

No Character encoding declared at document level

No character encoding information was found within the document, either in an HTML meta element or an XML declaration. It is often recommended to declare the character encoding in the document itself, especially if there is a chance that the document will be read from or saved to disk, CD, etc.

The W3C site provides information on character sets and encoding of webpages at Tutorial: Character sets & encodings in XHTML, HTML and CSS.

There are, of course, many other useful references on the matter on the web. The Wikipedia article, Character encodings in HTML explains how browsers determine the character encoding of a webpage. Wikipedia provides information on issues related to the internationalization and localization, often abbreviated as i18n (where 18 stands for the number of letters between the i and the n in internationalization, a usage coined at DEC in the 1970s or 80s) and L10n respectively. The capital L in L10n helps to distinguish it from the lowercase i in i18n.

UTF-8: The Securet of Character Encoding has a good explanation of why it is advisable to specify the character encoding for your HTML documents and why using UTF-8 is recommended.

The webserver is providing information on the encoding of the webpages, i.e. it is sending Content-Type: text/html; charset=UTF-8 in the HTTP headers it sends to browsers, but I haven't been including a meta tag in the pages specifying the encoding, i.e. I haven't been using <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">. I decided to add that immediately after the <head> tag in the template I use for my webpages.

[/network/web/html] permanent link

Tue, Mar 24, 2009 8:41 am

HTML Validation

If you want to check your HTML code to ensure that it is correct, you can use The W3C Markup Validation Service. The service is free and will point out lines in your code with errors. Even though a page may look correct when you view it in your browser, it may still contain errors; the particular browser you are using may compensate for the incorrect code or just happen to present it in the way you expect, but other browsers may not be so forgiving, so not everyone who visits your site may see the page as you see it, if it has errors in the HTML code. Of course, due to to variations in the way browsers interpret the code, the page may not look exactly the same to all visitors even if the code is valid, but you are, hopefully, reducing the chance of problems by correcting the code.

[/network/web/html] permanent link

Fri, Mar 06, 2009 8:20 pm

Centering a Div

One of the many ways in which Firefox, Netscape, Internet Explorer, and other browsers interpret the same HTML code differently is when margin: auto is used to center a block on a webpage, such as a div section. Adding margin: auto to the style definition for a block will result in the block being centered when viewed in Firefox or Netscape, but it isn't sufficient to result in the display of a centered block in Internet Explorer. To have the block centered in Internet Explorer, you have to also add text-align: center to the style definition of the body tag.

[ More Info ]

[/network/web/html] permanent link

Sun, Jun 17, 2007 2:43 pm

Links Without Underlining

Occasionally, I want a specific link to appear in a webpage without underlining. You can add style="text-decoration:none" with the link to prevent the text associated with the link from being underlined.

For instance, sometimes I use superscripts in a document to link to a reference. Normally a link will be underlined, which will look slightly odd. E.g., if I link back to the reference 1, I used for this blog entry, the number "1" has an underline below it. If I don't want it to appear I can use the HTML code below.

<a href="http://www.pageresource.com/html/link3.htm" style="text-decoration:none"><sup>1</sup></a>

Using that code the reference 1 superscrpt is not underlined.

If you don't want any URLs in the webpage underlined, you can add the following code to the head section of the HTML for the webpage.

<STYLE type="text/css">
<!--
A { text-decoration:none }
-->
</STYLE>

With the above code placed between your <HEAD> and </HEAD> tags, you can code your links as you normally would, but none of them will be underlined. The style sheet in the head section will make them all non-underlined.

[/network/web/html] permanent link

buy flowers at justflowers.com Great Deals Every Day @ Geeks.com Holiday Flowers

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo