Mandarin Logo
MainBlogFAQsBox TipsText TricksColor ChartFree GalleryCSS Opacity
TWO CENTS CURRENT ISSUE 2006 WEST SACRAMENTO CALIFORNIA
FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...

Matted Style CSS Border Gold

How to Float Image to the Left

This image with a frame and matte is coded for floating an image to the left with padding of 10 pixels between the image and the text. You can copy the code (image included) and use it as it is. Or copy the code and then insert the name of your image and the width and height of your image. The rest of the code doesn't need to be changed.


Copy and paste this in your Blog or Web page.

It will look like this.

YOUR TEXT GOES HERE

Matted Border: Float Left
#  Last Updated:  Tuesday, June 29, 2004
You are viewing one post
VIEW ALL    BACK TO TOP
FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...

Float Left with Less Code
One Line of Code
Add a Margin

In the comments of the last post Doc Shazam suggested that we could the do the same thing with only one span by adding the margin. JR mentioned that it could be done with just one span, but without the margin added it broke in Mozilla. That might be what he was trying to say "add a margin". So here we added a margin to the first (and only) span. Both methods work but this one uses only one span.


Copy and paste this in your Blog or Web page.

It will look like this.

YOUR TEXT GOES HERE

That is only one line of code. It's one long line of code but it is only one line. This method works in IE and Mozilla so you can save a few keystrokes by using this version of the matted border code. We put a margin of 15 around all sides for simplicity. You could specify margin-right and margin-left if you really want to tweak it.

Float Left with Less Code
#  Last Updated:  Monday, June 28, 2004
You are viewing one post
VIEW ALL    BACK TO TOP
FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...

CSS FLoat Right

Using CSS Inline Style

Float Image and Text Caption Right


Goodrich Wins

There is one difference between the Float Image Left code and this float. We added padding-left to the paragraph that floats to the right so that the text and the image have more space between them.

We are floating the picture to the right by adding style float:right to the paragraph tag . We need to tell the browser how wide to make the paragraph that will contain the image and the text caption on the right. Since our image is 100 pixels wide we guess and make the paragraph 125 pixels wide so that we have some extra space.

The text that we are typing in after the first paragraph will automatically align to the left. This technique is simple, just some style added to the paragraph tag. We added extra words here so that the full effect displays.

Copy and paste (or type) this in your Blog or Web page.

It will look like this (image included).


Goodrich Wins

YOUR TEXT GOES HERE The text that you type here will automatically align to the left of the image. You can type as much as you want. The more you type the better it looks.

CSS Float Right: Image and Text Caption
#  Last Updated:  Sunday, June 27, 2004
You are viewing one post
VIEW ALL    BACK TO TOP
FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...

CSS FLoat Left

Using CSS Inline Style

Float Image and Text Caption Left


Goodrich Wins

We are floating the picture to the left by adding style float:left to the paragraph tag . We need to tell the browser how wide to make the paragraph that will contain the image and the text caption on the left. Since our image is 100 pixels wide we guess and make the paragraph 125 pixels wide so that we have some extra space.

We make the paragraph 125 pixels wide to give us some whitespace between the image and the text that we floated. The text that we are typing in after the first paragraph will automatically align to the right. This technique is simple, just some style added to the paragraph tag. We added extra words here so that the full effect displays.

Copy and paste (or type) this in your Blog or Web page.

It will look like this (image included).


Goodrich Wins

YOUR TEXT GOES HERE The text that you type here will automatically align to the right. You can type as much as you want. The more you type the better it looks.

CSS Float Left: Image and Text Caption
#  Last Updated:  Saturday, June 26, 2004
You are viewing one post
VIEW ALL    BACK TO TOP
FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...

How to Float a Boat

CSS Float Image Left

SPAN and IMG

We use two methods for floating our boat, one method uses the span and another uses the img tag only. If you are looking for the preferred method use the last one listed here (#4. SPAN with Padding). It works well and is probably the most popular method. It depends on how you want the image to display and where you want the text to wrap around the image.

We are using the SPAN tag with a padding of 15 pixels around the image here. We want the text to appear above, around, and below the image so we put the SPAN tag in the middle of our text. The placement of the SPAN that contains the image is up to you. Try floating the image first and then type in your text.

Copy and paste (or type) this in your Blog or Web page.

It will look like this.

We are using the SPAN tag with a padding of 15 pixels around the image here. We want the text to appear above, around, and below the image so we put the SPAN tag in the middle of our text. The placement of the SPAN that contains the image is up to you. Try floating the image first and then type in your text.


1. Span Without Padding

We don't like the text aligned next to the image. But, we can float our boat image to the left of our text using the SPAN tag. We have to type in enough text so that we don't run into the next tag and confuse the the browser.

Copy and paste (or type) this in your Blog or Web page.

It will look like this.

We don't like the text aligned next to the image. But, we can float our boat image to the left of our text using the span tag. We have to type in enough text so that we don't run into the next tag and confuse the the browser. Or, make sure that we close the end with a break clear.

2. IMG without HSPACE

IMG

We don't like the text aligned next to the image. But, we can float our boat image to the left of our text by adding the ALIGN="LEFT" in the IMG tag. We are typing just enough here to get the text to wrap so that you can see the alignment in action.

Copy and paste (or type) this in your Blog or Web page.

3. IMG With HSPACE

Add HSPACE to IMG

We like padding next to the image. We are using HSPACE="15" here. Most sites prefer 10. We increase the amount of padding depending upon the size of the image or what we think looks better. There is no rule.

Copy and paste (or type) this in your Blog or Web page.

It will look like this.

We like padding next to the image. We are using the hspace here. Most postings use a padding of about 10 pixels. We increase the amount of padding depending upon the size of the image or what we think looks better. There is no rule.

4. SPAN With Padding

Add PADDING to SPAN

We like padding next to the image. We are using a 15px padding here. Most images look good with padding:10px. We increase the amount of padding depending upon the size of the image or what we think looks better. There is no rule.

Copy and paste (or type) this in your Blog or Web page.

It will look like this.

We like padding next to the image. We are using a 15px padding here. Most images look good with padding:10px. We increase the amount of padding depending upon the size of the image or what we think looks better. There is no rule.

CSS Style Sheet

Float Left in Style Sheet

If you want to float everyday you can add this to your style sheet.

.floatleft { float:left; padding:15px; }

Then type this in your Blog or Web page.

It will look like this.

And then put your text here. You can type as much as you want, just type enough to clear the float.

You can add more to the float class definition; change the padding, or even add an image (the same image to display each time) and all kinds of spiffy stuff. It just depends on how you want it to display.

If you don't type in enough text to flow to the bottom of the picture you will want to clear the float. You can do that with a
clear:left
clear:right
clear:both

I type it in after the paragraph ends (rarely needed).

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

CSS Float Left: Float a Boat
#  Last Updated:  Tuesday, June 22, 2004
You are viewing one post
VIEW ALL    BACK TO TOP
FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...

Text Tricks: Newspaper Column Alignment

Is there an easy way to align text like Newspaper columns?

Add the style="text-align:justify;" to your tag.

This is column in a small table where we are using the justify alignment within the table data. If you want a newspaper or article styled page you can use this technique.

The next column begins on the right side and aligns the text defined as text-align:justify. The justify is what spreads the text across the column in a newspaper or magazine style.

Copy and Paste this in your Blog or Web page.

It will look like this.

This is column in a small table where we are using the justify alignment within the table data. If you want a newspaper or article styled page you can use this technique.

The next column begins on the right side and aligns the text defined as text-align:justify. The justify is what spreads the text across the column in a newspaper or magazine style.

Newspaper Column Alignment
#  Last Updated:  Friday, June 18, 2004
You are viewing one post
VIEW ALL    BACK TO TOP
FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...

CSS Box Triple Framed
Bordered Image


Image without a border

For the triple border to work the width and height of the image is included in both the img tag and the div that surrounds the image to make the matted frame look. A right-click on the image to view the properties tells us that this image is 110 x 160.

Copy and paste this in your Blog or Web page.

It will look like this.

Note: We centered the image for demonstration only. It will not be centered when you copy it. To center the image use the following code.

It will look like this.

Triple Framed and Bordered Image
#  Last Updated:  Thursday, June 17, 2004
You are viewing one post
VIEW ALL    BACK TO TOP
FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...

Boxes and Borders

Pink Centered Box

How can I make a pink centered box? It didn't work when I tried it.

We use the DIV tag to make a centered box.

Your text goes here. Don't press the enter key until you start typing your text in here inside the box.

Copy and paste this in your Blog or Web page.

It will look like this.

Your text goes here. Don't press the enter key until you start typing your text in here inside the box.



Code updated March 2004. Best practice is in Center Box Margin Auto

Pink Centered Box
#  Last Updated:  Monday, June 14, 2004
You are viewing one post
VIEW ALL    BACK TO TOP
FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...

DIV to Center Squares

foxglove 1 Decorative images. fox3

Q: I just also took note from your May 30 'Little Squares' post, that you put the IMGs in their own DIV. What does that buy you? I want to understand more of this stuff.

A:The div is a container for the three images. I used it to center the images. That's all.

1. Images in a Div

foxglove 1 Decorative images. fox3

2. Images not in a Div

foxglove 1 Decorative images. fox3

One could use the paragraph tag or other block level tags to center the three squares but I like the way the <div align="center"> behaves.

<div align="center"> images go here... </div>

Another way, the more purist method I think, is to use <div style="margin:0px auto;">. But that doesn't work in every browser, particularly in one older browser that I use. Your mileage may vary.

<div style="margin:0px auto;"> images go here... </div>
Div to Center Squares
#  Last Updated:  Sunday, June 13, 2004
You are viewing one post
VIEW ALL    BACK TO TOP
FAQsHTML and CSS Frequently Asked Questions
"For People Who Make Mistakes" ...

Named Colors

What are the 16 named colors that work in all browsers?

The HTML 4 keyword color names are black, green, silver, lime, gray, olive, white, yellow, maroon, navy, aqua, red, blue, purple, teal, fuchsia, and aqua. The color names are not case sensitive.

Black   000000  Green   008000
Silver   C0C0C0  Lime   00FF00
Gray   808080  Olive   808000
White   FFFFFF   Yellow   FFFF00
Maroon   800000  Navy   000080
Red   FF0000  Blue   0000FF
Purple   800080  Teal   008080
Fuchsia  FF00FF  Aqua   00FFFF

The Color Chart has a list of all named colors.

Color Names
#  Last Updated:  Saturday, June 12, 2004
You are viewing one post
VIEW ALL    BACK TO TOP
MAIN BLOG FAQs CSS:Boxes TRICKS About CSS Style Color Chart GALLERY PureText
Validate HTML Validate Style Sheet Elements of Style Yahoo Buzz Google Zeitgeist Lycos 50 TP TP2 TF Technorati Sitemeter
Mandarin Archives 2005: J F M A M J J A S O N D   2004: J F M A M J J A S O N D   2003: J F M A M J J A S O N D   2002: F M A M J J A S O N D
Clean PC Banners Free Banners Tag Board Gator ColdFusion Fade Images Refer Grouping Web Help Drop Caps
This work is licensed under a Creative Commons License