CSS to create floating box
- Width of picture : 120 px, border 1 px (total width = 122)
- Create a floating box and define the style for text and border :
.float_thumb_3_120 {
float: left;
width: 122px;
margin-left: 14px;
margin-right: 14px;
margin-bottom: 1px;
padding: 0px;
float: left;
width: 122px;
margin-left: 14px;
margin-right: 14px;
margin-bottom: 1px;
padding: 0px;
font-family: arial, sans-sherif;
font-size: 8pt;
border-style: solid;border-width: 1px;border-color: #d1dae3;
}
font-size: 8pt;
border-style: solid;border-width: 1px;border-color: #d1dae3;
}
Width of container
- Compute the width of the container :
n1 = 3 * ((width of pic + border) + margin-left + margin-right)
n2 = margin-left
n = n1 + n2
Here we get :
n1 = 3 *((120 + 2) + 14 + 14) = 450
n2 = 14
Here we get :
n1 = 3 *((120 + 2) + 14 + 14) = 450
n2 = 14
n = 464
The HTML
- Use this html at the position of the pictures :
<div align="center">
<!-- container -->
<div style="width: 470px;">
<!-- titles -->
<p class="float_thumb_3_120" style="border-color: #7da7fc">
Some text for pic 1</p>
<p class="float_thumb_3_120" style="border-color: #7da7fc">
Some text for pic 2</p>
<p class="float_thumb_3_120" style="border-color: #7da7fc">
Some text for pic 3</p>
<div style="width: 470px;">
<!-- titles -->
<p class="float_thumb_3_120" style="border-color: #7da7fc">
Some text for pic 1</p>
<p class="float_thumb_3_120" style="border-color: #7da7fc">
Some text for pic 2</p>
<p class="float_thumb_3_120" style="border-color: #7da7fc">
Some text for pic 3</p>
<!-- pictures -->
<p class="float_thumb_3_120"><img src="URL of picture 1"
style="width: 120px; height: 90px;"></p>
<p class="float_thumb_3_120"><img src="URL of picture 2"
style="width: 120px; height: 90px;"></p>
<p class="float_thumb_3_120"><img src="URL of picture 1"
style="width: 120px; height: 90px;"></p>
<p class="float_thumb_3_120"><img src="URL of picture 2"
style="width: 120px; height: 90px;"></p>
<p class="float_thumb_3_120"><img src="URL of picture 3"
style="width: 120px; height: 90px;"></p>
</div>
</div>
style="width: 120px; height: 90px;"></p>
</div>
</div>
The Pictures with Titles
Loading the supplemental Style Sheet
- As GPC remove the standard tag to add a style sheet :
<link rel="stylesheet" type="text/css" href="URL of the supplemental style sheet">
- We need to write a little Javascript in the first editable section of the page :
<script language="Javascript" type="text/javascript">
var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href =
'http://YOURSITE.googlepages.com/float_box_style.css';
cssNode.media = 'screen, print';
cssNode.title = 'style sheet for floating box';
document.getElementsByTagName("head")
[0].appendChild(cssNode);
</script>
var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href =
'http://YOURSITE.googlepages.com/float_box_style.css';
cssNode.media = 'screen, print';
cssNode.title = 'style sheet for floating box';
document.getElementsByTagName("head")
[0].appendChild(cssNode);
</script>
More Informations
- Borders for your Pictures
- Rounded Corners
- Scrolling with scrollTop
- Using a lightbox for your pictures
- Use Media RSS Fee to create your own Slide Show
Other Examples
- Accesskeys for your site
- Color bar
- Ajax and xml
- A blog and a feed on a site
- How to integrate a spreadsheet
- Changing the width of columns
- Internal links, indentation and drop caps
- Changing the background
- Using frames with GPC
- Changing style of links
- Using simple template black or white
- Create borders for your pictures
- Scrolling text and pictures with scrollTop
- Changing opacity and transparency
- Using a lightbox for your pictures
- Lightbox2 - To Display a Set of Pictures
- Slimbox, another clone of lightbox
- Using text box with rounded corners
- Testing Menu from ButtonGenerator.com
- Playing with iframe
- How to integrate Google CSE to GPC
- A Plugin to add a Custom Search Engine to the Toolbar
- Fixed menus and dynamic contents
- Playing mp3 files
- Playing Video with GPC
- How to display Flickr photos on your website
- Favicon, Feed and Redirection
- Media RSS and Slide Show for your GPC Page
- Using Float Box for AdSense







