SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    London, UK
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fixed Table - help !

    What code do i use to make a table which doesnt expand when the text reaches the end?
    I want a table which will form a new line for text rather than expanding.
    In other words when writing text the table expands rather than keeping the original size and moving the text to the next line.
    I am using dreamweaver to make my website but i can't find an option to turn off this default feature for tables.
    Does anyone know the html code or know of an option in dreamweaver which stops this?

    Many thanks in advance
    Add your web design / hosting companies to my directory - Web Hosting Directory
    Want to join our panel of experts? - Hosting Forums ( top right of forums -expert drop down box for more info ).

  2. #2
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tim all you need to do is assign the TABLE a numerical value like so:

    <table width="600">

    I will point out that there are times when the contents of the TABLE may override the width you have assigned. If a combination of page elements add up to more than your value then the TABLE's edge will be pushed out to accomodate the elements. Also if someone types in a "word" that is longer than the TABLE border is wide the same thing will happen. This happens many times in Guestbooks where someone will type something like this:

    I just loooooooooooove such and such.

    Add on about another 200 o's and you'll see what I'm talking about.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  3. #3
    Net Senior Citizen tommatthews's Avatar
    Join Date
    Apr 2001
    Location
    Sydney Australia
    Posts
    869
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is well worth looking at so your tables don't budge:
    MSDN table-layout Attribute


    affordable website design

    :: sydney australia ::

  4. #4
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    London, UK
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Msn tutorial confused me

    Originally posted by tommatthews
    This is well worth looking at so your tables don't budge:
    MSDN table-layout Attribute
    I have got round the problem now, many thanks for all the help.
    The tutorial at msn doesnt seem to work properly anyhow, i tried the following code.

    <TABLE STYLE="table-layout:fixed" WIDTH=600>
    <COL WIDTH=100><COL WIDTH=300><COL WIDTH=200>
    <TR HEIGHT=20>
    <TD>...</TD><TD>...</TD><TD>...</TD>
    </TR>
    :
    </TABLE>

    But if someone types a long word without a space then the table expands and is not fixed as it should be.
    Did i miss something or is the tutorial wrong?
    Add your web design / hosting companies to my directory - Web Hosting Directory
    Want to join our panel of experts? - Hosting Forums ( top right of forums -expert drop down box for more info ).

  5. #5
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Read my post above. If someone types a long word there is nothing that you can do about it.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  6. #6
    SitePoint Enthusiast
    Join Date
    Oct 2001
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To solve this set your table widths the way you want.

    Type the info in notepad then just copy and paste in the tablecell and whala the table will not budge.

    I had this same problem with GoLive and noticed if you paste the text rather than writing it the table would not move.

    Hope this helps...

  7. #7
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As I mentioned before, this is not a "Go-Live" thing and simply cannot be solved. If the elements inside a TD tag are wider than the width applied to the TD tag then the TD tag will expand. You cannot get around this.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  8. #8
    SitePoint Enthusiast
    Join Date
    Oct 2001
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry creole but i have to disagree with you. If your using a wysiwyg editor and you copy and paste the text it will break the text accordingly and never expand the table.

    maybe when you hand code its different but he was using dreamweaver. you can paste a thousand words into a table thats 100 pxls wide it it will not budge. It will change the height but width will not move.

  9. #9
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    creole is correct. I know what you're saying, but that depends on the editor. Dreamweaver and other editors have built in things like this to prevent these problems.

    creole is simply saying that if the actual data on a web page is extending beyond the table width, there is nothing that can be done to prevent that without modifying the code.

    With PHP (or other server-side languages) there's a simple solution; have it count the characters/words and insert a line break when a certain number is reached.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  10. #10
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Let's say that the width on your TABLE is 500 pixeks and you put two imags in there (side by side) that total to 550 pixels. What do you think will happen to the TABLE? It's going to expand. The same goes for a piece of text. If someone types a long word like thiiiiiiiiiiiiiiiiiiiiiiiiis (and about another 200 i's) the TABLE will also break.

    It's the way HTML works and there's nothing you can do about that.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  11. #11
    SitePoint Enthusiast
    Join Date
    Oct 2001
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not doubting you at all. You are absolutly right.

    but my point was in his situation...

    1. hes using dreamweaver
    2. hes talking about text not images
    3. he needed a solution

    the solution i gave will work every time.

    but your still right...
    if your typing the words the table will expand unless you break the line yourself when you know a word will be too long.

    im not trying to argue so please dont take it that way, but my answer is right as well...for his situation. If you cut and paste from notepad and your using an editor(drewamweaver, golive...) it will solve that particular problem.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •