Jul 27, 2008

A Demonstration Of Floats, Clears And Absolute Positions - See the differences here...

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > CSS (Cascading Style Sheets)

free web hosting

A Demonstration Of Floats, Clears And Absolute Positions - See the differences here...

jlhaslip
Got working on something the other day and came up with this small demonstration on the differences between several techniques using the same html code, but different CSS to position a block of four thumbnail images approximately the same ( well, similar at least ) onto a page and the resultant differences in the effect of the techniques. Have a look: http://www.jlhaslip.trap17.com/samples/mis...ions/index.html

The first one uses floats to group the images into a fixed width block and then uses absolute positioning of the wrapper div to space them off the left hand side and down a little from the top of the page. That last paragraph actually follows the code for the Image block if you do a view > source, but the absolute positioning of the group of pictures removes the block from the normal flow of the page, which allows the paragraph to slide up. Might be what you want, but re-sizing the viewport will alter things . Try it.

The second one uses absolute positioning of each image and a percentage of the viewport to place the same four images into pretty much the same place on the display... well, my display at least... and therein lies a problem with position:absolute and percentages for layout. Resizing the Browser viewport changes stuff, majorly... Oh, and because the Image Blocks are declared to be 100% width of the viewport, and because of the manner in which the browser places the absolutely positioned div's onto the page {after} positioning the rest of the page, the image block is effectively a 'layer' over top of the third and fourth links, so you can't click them because the Browser ties to click the Image block layer, but there are no links there. The links are under the transparent Image block. Click the first link to access links three and four.

The next page uses Floats to group the Image and margins to space the grouped images off the left hand side approximately the same as the previous pages. notice how the trailing paragraph is displayed beside the group of Images? This is a result of using Float to position the grouped pictures. The paragraph will 'wrap' the images, taking up the next available spot on the display, next to the images. This is a common technique used in layouts.

Lastly, if you don't want the 'wrapped' look, then 'clear' the block of images by using 'clear:both' on the trailing paragraph. Options for the clear are left : right and both, depending on the presentation you want to provide for the page.

Hope this helps you understand that css is a handy tool for laying out your pages, and does a good job of it, but be careful how you go about it. There is usually more than one method that you have available to create the same/similar look to a page, and each of them has various side effects. The method you choose might be the right one, but it might not be...

 

 

 


Reply

suberatu
Very nice. I'm not too much into CSS, but I can appreciate a demonstration and explanation that is as clear and easy-to-understand as yours. Even though I'm not strong with CSS, I was able to follow most of what you said, or at the very least the concept, if not the actual coding.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : demonstration, floats, clears, absolute, positions, differences,

  1. What Will Be The Side Effects If We Can Move And Think On The Speed Of Light
    What differences can we see if we can think, move or do what ever with (2)
  2. Age Differences Of Friends
    (8)
    Just a discuss of what age differences you think should be between you and friends, should there be
    example: you are 17 and you have certain friends, what age differences should there be. 1 year
    older difference 2 year older difference 3 year older difference 4 year older difference 5 year
    older difference OR 1 year younger difference 2 year younger difference 3 year younger difference
    4 year younger difference 5 year younger difference....
  3. Free Web Hosting: (absolute Zer0) [screened] [approved]
    Free Website: <rbau.trap17.com> (2)
    To generate an application for free web hosting please click here: Free Web Hosting
    Request Form I would like to request free web hosting from Trap17. Please find my application
    below. Your Registered Domain Name or Desired Trap17 Subdomain Name: rbau.trap17.com
    Account Username: RBAU Introduction: I'm into game programming, I play a lot
    of video games, I'm interested in airplanes and rockets too. Email Address:
    absolute000@gmail.com Age: 17 Country Where I Live: United Stat....
  4. Jsp Versus Php
    about differences between JSP and PHP (1)
    Both of JSP and PHP are technologies used to build dynamic web sites, JSP embeds java syntax with
    html to create dynamic pages, while PHP is an open-source page scripting/templating system, but in
    the long run, JSP and Java provide a more powerful system. Here is a list of reasons why JSP is
    better than PHP: QUOTE - Anything you can do with PHP, you can do with JSP; the reverse is not
    true - JSP is much more powerful, since it has access to all the Java libraries. PHP only has
    access to PHP libraries - JSP is Object-Oriented, so leads to cleaner code that'....
  5. Does Duplicate Content Affects Search Engine Positions ?
    (1)
    http://www.000webhost.com Great news: Since 2007-12-01 we do no require phone number
    verification by SMS message. Now everyone can register and start using our services in 5
    minutes! 000webhost.com is making a revolution in web hosting industry. Look what we offer
    totally free: 250 MB disk space, 100 GB data transfer, cPanel access, full domain hosting allowed,
    backups, end user support and much much more.. With 000webhost.com your website will load lightning
    fast, and we have lots of features, sometimes even more you can get with paid hosting. Choose the
    new ge....
  6. Differences Between Trap17 & Qupis
    (3)
    I juz got my trap17 starter account when I found out about the alternative called qupis which seems
    to provide the same features but only restricted with ONE LINE TEXT AD at bottom of page. I hope
    someone can clarify this and if this is the case, then it will be just active participation in the
    forum VS 1 line of text ad. So what are the real differences and advantages for users of trap17 over
    those using the ad supported Qupis?....
  7. Absolute Value In C
    (4)
    Hey, I'm writing a program for a friend in Calculus. The goal is for him to be able to input a
    number, and have the computer return whether it is positive or negative, and its absolute value.
    Here is what I have so far: /* positive.cpp * The program that gets a number and checks if it is a
    positive number. *It prints an appropriate message indicating if it’s positive or negative and also
    prints the *absolute value of the number. */ #include #include "genlib.h" #include "simpio.h"
    main () { int num1; bool positive; printf("This program will deter....
  8. 3d Landscape In Swishmax (flash)
    some syntax differences but basically same as flash (1)
    OK! this tutorial is inspired by a game at addictinggames.com... im not sure how many of you
    have played it but here it is: God's Playing Field Its a cute little game... but when i first
    played it i though HOW DOES IT DO THAT!!! and by that i mean dot he 3d with the mouse
    and then today i finally got around to making it... I used one of the oldest tricks in the book...
    so lets educate you a lil about flash... Flash does not support 3D directly, you have to find some
    way to make your own. You could develop some complicated system for which you co....
  9. Ie And Firefox Layout Differences
    (10)
    I have had a go at making a website using CSS to dictate the layout (no tables used) and it works
    quite nicely in firefox but when i open it in IE it completely mangles the whole layout. Can
    someone tell me some techniques to prevent this and maybe point me to some helpful pages. Thanks.....
  10. Compare Two Vars And Highlight The Differences
    (7)
    I need a script that compares 2 variables, and looks for a difference between them. It will then
    highlight the words that are different, as shown in the image below: So in the left cell, the
    yellow text is the text that has been removed OR replaced. In the right cell, the green text is the
    text that has replaced some text in the left cell, OR new text. This script will be used to
    compare 2 versions of a document stored in the database, to see the difference between each change
    (all revisions are stored in the database). I know that it's possible with PHP, beca....
  11. Free Web Hosting: (absolute)
    Free Website: <ABSOLUTE-ASSASSINS.NET> (1)
    To generate an application for free web hosting please click here: Free Web Hosting
    Request Form I would like to request free web hosting from Trap17. Please find my application
    below. Your Registered Domain Name or Desired Trap17 Subdomain Name: ABSOLUTE-ASSASSINS.NET
    Account Username: Absolute Introduction: hobbies = computers, web design
    and gaming Email Address: mdjd2@hotmail.com Age: 34 Country Where
    I Live: USA My Websites Theme: MapleSEA Reason I Chose T....
  12. Differences Of Squares
    (10)
    Hi guys , I just found out that the differences of squares form an arithmetic series with d = 2 ,
    but I can't figure out why : 3 5 7 9
    11 - notice the difference 1 4 9
    16 25 36 - the squares 1^1, 2^2, 3^3 ,
    4^4 , 5^5, 6^6....
  13. What Is Absolute Zero?
    (9)
    Absolute Zero is the temperature at which the molecular motion ceases and the average kinetic energy
    of molecules becomes zero. Absolute Zero is the lowest attainable temperature. It is
    -273 in the Celsius scale. In other words. at -273 Celcius everything freezes and the molecular
    motion (molecules move around hitting other molecules) stops... This is physics /rolleyes.gif"
    style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> ....
  14. Free Web Hosting: (absolute)
    Free Website: <absolutemaple.trap17.com> (1)
    To generate an application for free web hosting please click here: Free Web Hosting
    Request Form I would like to request free web hosting from Trap17. Please find my application
    below. Your Registered Domain Name or Desired Trap17 Subdomain Name:
    absolutemaple.trap17.com Account Username: Absolute Introduction: I am a
    gamer, I love computers and the internet. Email Address: dthor Age: 26
    Country Where I Live: USA My Websites Theme: MapleStory Reason I
    Chose Tra....
  15. Oracle And Cisco, What Are These,
    and the main parts and differences of both (4)
    Hey, pretty much a newb when it comes to comp programs/systems, and i saw things about Oracle and
    Cisco, and wanted to know what they are. LoL Shortened the Title and description so it doesn't
    wreck the Index page. ....
  16. Server Differences?
    Between Gamma & Delta (3)
    I uploaded a script as a free member and saw it worked so I decided to buy hosting. Then I uploaded
    the script as a paid member and it didn't work. The main thing I noticed is that the free member
    server's name is gamma and the paid one is delta. I am mostly worried because if I can't
    get my script to work, I can't keep staying hosted here. Is there any way that I can be a paid
    member and have my script still hosted on the gamma server? Delta's driving me nuts.
    /wacko.gif" style="vertical-align:middle" emoid=":wacko:" border="0" alt="wacko.gif" /> ....
  17. Script Won't Work At Trap17 -- Version Differences?
    But works flawlessly in my machine... (12)
    Here is the code: CODE <?php $data_array = array(); $data_array2 =
    array(); $file_name = "menu_data.txt"; $handle =
    @fopen($file_name, "r"); if (!$handle)  {     echo "File
    Handle Not Available For Use"; exit;         } while (($data = fgetcsv(
    $handle, 1000, ",")) !== FALSE) {         if ( (strpos
    ($data[2],"$page=")))     {
                        $data_array[] =  t....
  18. Php Version Differences? Or Not?
    between the trap and XAMPP??? (5)
    The Trap uses php version 4.4.1 and I have downloaded and installed the XAMPP php Local Server
    configuration which includes php version 5.1.1 and mysql and perl etc, but this question relates to
    the php because that is where I am currently having difficulties. This is the script I am having
    problems with locally: http://www.trap17.com/forums/script-build-...nks-t33362.html Both places
    have the same identical files, code and data. Both are folders in the root directory. I have used
    phpinfo function to confirm the server root is what it should be (public_html and htdo....
  19. Podcasting For The Absolute Newb
    simple, works on windows, mac and linux (5)
    Ok, so I found out about podcasting on iTunes, and I fell in love with it. It was probably the
    coolest thing ever to happen. Now it's a big thing, and anyone can do it. This will cover just
    the basics of using MP3 file, tagging them, and uploading them in a directory on a web server with
    dircaster installed. If you want to get advanced I reccomend getting a book on it. This is only the
    basics, because I am running a windows computer at the time, and you can only have enhanced
    podcasting in mac at the time of me writing this... Let's get started. First things fir....
  20. Those Absolute Essentials
    Hardware is of use without these (0)
    Imagine buying a spanking new computer with all those frills-a high end processor and the latest
    graphics card ,gigabytes of RAM,a hard drive with tons of space,7.1 surround speakers,dual layer DVD
    burner,LCD monitor,wireless keyboard and mouse,but finally you will need an OS the obvious choice is
    WIN XP . OS is not the only software by which you can enjoy the benifits of all these
    softwares.yes i agree that the OS has some basic softwares like Text editore,browser,media players
    but are these enough to control the monsters mentioned above Even the most high e....
  21. Pentium M Differences: 1.73ghz? 1.86? 2.1?
    (2)
    Hi. Trying to decide how fast a chip (Pentium M) to buy for my next notebook. The HP I'm
    looking at goes up to 2.13 GHz. I can afford to go with a 2.0 GHz, but can save $100 if I go
    with a 1.86. I can save more if I go with a 1.73. Any advice on Pentium M CPU speed? Any reason I
    should not buy the fastest one I can afford...without buying _the_ fastest (with the biggest price
    premium)? My experience tells me it's not worth the money to buy the _fastest_ CPU, but to go
    with a step down from the fastest. I'd appreciate any thoughts on this. Than....
  22. Server Absolute Referencing
    on a trap17 sub-domain (4)
    When referencing a file or pix inside an html file, there are absolute references, relative
    references and server absolute references. I think I am okay with the first two kinds, but have a
    question about server absolute. Assume I have a subdomain of the Trap17 named subdomain. In the
    subdomain, I have a public_html folder which contains the files accessible from the web, so if in
    one of those files, lets say it is located in a folder named folder1 and is inside the public-html,
    I insert a "server absolute reference", does the reference begin at the public_html folder?....
  23. Police Assault On On Peaceful Demonstration
    German army's 50th anniversary (3)
    No Oath, No Murder, No Morning Sports... (join us!) Two days ago, on Wednesday, the german
    government celebrated the 50th anniversary of german's army. All the members of parliament
    attended this event except for the entire fraction of the newly-formed socialist party , some of
    them declared they would join the "50 years Bundeswehr are 50 too much"-demonstration which was
    supposed to start in the late evening. Police officials stated that at the beginning, there were
    about 1,500 people in the demonstration and half an hour later this number had risen to about....
  24. Inspiron/latitude/precision Quality Differences?
    (6)
    Hi, are there differences in quality concerning the Latitude/Inspiron/Precision models? For
    example are the more expensive latitudes more sturdy, have higher quality components or are they all
    the same in all 3 different product lines? andrescasta....
  25. Base Tag
    relative or absolute? (2)
    Ive read the w3schools tag description for and i fount that it must be written in this format:
    HTML base href =" http://www.mysite.trap18.com/img/ " /> So what im asking is if this
    href must be absolute or can it be relative like: HTML base href =" /img/ " /> As i did
    not find anything about it on w three skulls nor in google (yet i only visited a few links).
    Absolute links slow down the retrieving of the info right? Thanks! -10730....
  26. Disgusting
    Chrisitian demonstration at a funeral (6)
    THESE PEOPLE DONT DESERVE THE RIGHT TO LIVE QUOTE I think many of you have seen the pictures of
    Westboro Baptist Church pickets the cult-members have put up. Now the discussion grew in Todays
    Pictures ( http://www.militaryphotos.net/forums/viewt...pic.php?t=52566 ), and I didn't want to
    continue to hijack that thread so I thought I'd make this thread. I, and other board-members,
    are disgusted about the pictures posted. I think the pics speak for themselves. As an example;pic
    That example pic had this comment "Lots of signs at Tracy High School graduation i....
  27. Is There A Way To Make "absolute Links"?
    Like links in a picture.. (6)
    I wanted to try a different layout but my lack of in-depth html knowledge prevents me from moving
    forward....I didn't know where else to post this, but I needed help so... this is the image:
    http://img115.echo.cx/img115/3231/sonata3ga.png I wanted to do frames but I wanted also to make
    the links be from the image....... Meaning, you see the flowers? Where the petals come out of, the
    circular things >_>;; They're magenta, cyan, and green. Um...these things:
    http://img241.echo.cx/img241/6057/yellow9ru.gif . Well, I wanted to make links out of those circular
    ....
  28. Web Tracks Eraser 1.2
    This clears the web tracks on the hard drive. (1)
    This program clears your browser chace along with other files that your browser leaves behind.
    QUOTE When you browse the Web, your computer tracks all your activities. All these tracks are
    stored to your hard disk. Anyone who can touch your computer can know the web pages you have
    visited, images and videos you have ever seen. If you do not want leave any internet tracks on the
    hard drive after internet browsing, then you need Web tracks eraser. It is a free tool that clears
    the web tracks safely and completely with only one click. Web tracks eraser works with Inter....
  29. Teamspeak 2 Vs Ventrilo
    The Differences Between The Leading Voice Chat Programs (10)
    The Main Reason for this post is to decide the popularity of the voice programs. Since i currently
    host both a Teamspeak server and Ventrilo server and am currently in the process of creating a
    website for my supporters. I would like your opinions as to which is the better program and why
    you think it is, since i will be basing these results on which Server i keep and provide statistics
    for on the website. For those that have not heard of these programs i will include a short
    description of each program and the websites they can be found at. TeamSpeak # Optimal ba....
  30. Browsers And Css
    Differences in displaying CSS (5)
    (This looks like the best place to post this.. /unsure.gif' border='0'
    style='vertical-align:middle' alt='unsure.gif' /> ) What do other users do to
    'work-around' the differences in displaying CSS attributes in different browsers? Mainly
    Internet Explorer which doesn't fully conform to CSS unlike the Mozilla browsers and where older
    browsers like Netscape 4.x which have only minimal CSS implementation. On my website, now that I
    have converted it to PHP, I use a couple PHP 'if' statements to detect the user's
    browser and link them to different....

    1. Looking for demonstration, floats, clears, absolute, positions, differences,

Searching Video's for demonstration, floats, clears, absolute, positions, differences,
Similar
What Will Be
The Side
Effects If
We Can Move
And Think On
The Speed Of
Light - What
differences
can we see
if we can
think, move
or do what
ever with
Age
Differences
Of Friends
Free Web
Hosting:
(absolute
Zer0)
[screened]
[approved] -
Free
Website:
<rbau.tra
p17.com>
Jsp Versus
Php - about
differences
between JSP
and PHP
Does
Duplicate
Content
Affects
Search
Engine
Positions ?
Differences
Between
Trap17 &
Qupis
Absolute
Value In C
3d Landscape
In Swishmax
(flash) -
some syntax
differences
but
basically
same as
flash
Ie And
Firefox
Layout
Differences
Compare Two
Vars And
Highlight
The
Differences
Free Web
Hosting:
(absolute) -
Free
Website:
<ABSOLUTE
-ASSASSINS.N
ET>
Differences
Of Squares
What Is
Absolute
Zero?
Free Web
Hosting:
(absolute) -
Free
Website:
<absolute
maple.trap17
.com>
Oracle And
Cisco, What
Are These, -
and the main
parts and
differences
of both
Server
Differences?
- Between
Gamma &
Delta
Script
Won't
Work At
Trap17 --
Version
Differences?
- But works
flawlessly
in my
machine...
Php Version
Differences?
Or Not? -
between the
trap and
XAMPP???
Podcasting
For The
Absolute
Newb -
simple,
works on
windows, mac
and linux
Those
Absolute
Essentials -
Hardware is
of use
without
these
Pentium M
Differences:
1.73ghz?
1.86? 2.1?
Server
Absolute
Referencing
- on a
trap17
sub-domain
Police
Assault On
On Peaceful
Demonstratio
n - German
army's
50th
anniversary
Inspiron/lat
itude/precis
ion Quality
Differences?
Base Tag -
relative or
absolute?
Disgusting -
Chrisitian
demonstratio
n at a
funeral
Is There A
Way To Make
"absolu
te
Links"?
- Like links
in a
picture..
Web Tracks
Eraser 1.2 -
This clears
the web
tracks on
the hard
drive.
Teamspeak 2
Vs Ventrilo
- The
Differences
Between The
Leading
Voice Chat
Programs
Browsers And
Css -
Differences
in
displaying
CSS
advertisement



A Demonstration Of Floats, Clears And Absolute Positions - See the differences here...



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE