Welcome our webmaster and SEO forum
Please enjoy the forum, contribute what you can, and wind up the Moderators!
Results 1 to 5 of 5

Thread: css web page styling

  1. #1
    misheck is offline Junior Member
    Join Date
    Oct 2009
    Posts
    3

    Default css web page styling

    I need to to format or design my webpage using CSS. I want to have a body size of the page just large enough to accomodate all screen sizes. Then inside the body I need to have few boxes/columns inside the webpage there is basically going to be 3 columns 40%, 20% & 30 % and the rest used up by padding etc. All this will be done using css div.largecolumn, div.small column etc.
    What I dont know how to do is to fomat the whole body to a size that I want and then after I aslo need to format the div tags to be able to fit into the new body size. Will I be able to format the div tags in css directly eg. div.largecolumn {width: 40%} also will I be able to use percentage rather than px because I have no clue how to measure a page using pixels or will I need to reference them after body tag?

  2. #2
    airforce1's Avatar
    airforce1 is offline Senior Member
    Join Date
    Sep 2009
    Posts
    203

    Default

    The name, CSS - cascading style sheet, tells us all about it.
    The selectors with higher cascade levels or weight all be applied to the final elements or tags on your pages. Generally practice like this: naming an outer container div to hold all the contents and setting a width as you want via % or px, both would be OK.

  3. #3
    Alfredwinston is offline Member
    Join Date
    Oct 2009
    Posts
    78

    Default

    It will be ok to use any of both . I suggerst you using % for width since using px in width can trouble you in low resolutions

  4. #4
    Phunk Rabbit is offline Junior Member
    Join Date
    May 2010
    Posts
    2

    Default

    Quote Originally Posted by misheck View Post
    I need to to format or d...

    ...eference them after body tag?
    Hi mishec,

    As a quick example (because example is a better tool to learn from than theory, imo) I will show you the structure I would use below:

    The HTML:

    Be sure to add your DOC type etc. I normally use XHTML 1.0 Strict and there maybe issues using my code below in anything other than this.

    HTML Code:
    <body>
         <div id="wrapper">
              <div id="largecolumn">
                   <h2>Title</h2>
                   <p>The small red fox jumped over the lazy brown dog.</p>
              </div>
              <div id="smallcolumn">
                   <h2>Title</h2>
                   <p>The small red fox jumped over the lazy brown  dog.</p>
              </div>
              <div id="mediumcolumn">
                   <h2>Title</h2>
                   <p>The small red fox jumped over the lazy brown  dog.</p>
              </div>
              <p class="clear"></p>
         </div>
    </body>
    So what we have here is:

    ID: Wrapper, this is used to contain your columns.
    ID's: large, medium, small - The columns.
    Class: Clear, This is used to stop anything below, i.e. footer etc, from bumping up into your columns or floating underneath a short colum when you dont want it to.

    The basic CSS is as follows:

    Code:
    /* Reset your elements */
    div, h2, p { margin:0; padding:0; }
    
    /* Classes */
    .clear { clear:both; }
    
    /* ID's */
    #wrapper, #largecolumn, #mediumcolumn, #smallcolumn { float:left; }
    
    #wrapper {
         width: 96%;
         padding: 0 2%;
    }
    #largecolumn {
         width: 40%;
         margin: 0 1%;
    }
    #mediumcolumn {
         width: 30%;
         margin: 0 1%;
    }
    #smallcolumn {
         width: 20%;
         margin: 0 1%;
    }
    
    #wrapper div h2 {
         margin: 5px 5%;
    }
    #wrapper div p {
         margin: 3px 5%;
    }
    This will produce your 3 columns and it gives a small gutter between each one, I have also popped a little spacing around the header and paragraph.

    Most importantly, experiment. Deleting a line or style may mess up the page but you can always change it back, the best way to learn is to experiment and learn from your achivements, mistakes and failures/sucesses.

    I hope this post has given you atleast a little insight.

  5. #5
    craftygeek is offline Junior Member
    Join Date
    Jun 2010
    Location
    Norfolk, UK.
    Posts
    21

    Default

    One thing to consider when building using fluid widths, is that when viewed on a widescreen monitor, some paragraphs can become very wide & difficult to read as a result.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124