Page 3 of 4 FirstFirst 1 2 3 4 LastLast
Results 31 to 45 of 46

Thread: Xhtml css School

  1. #31
    the roXor <3 Arbalest's Avatar
    Join Date
    Jan 2008
    Location
    above
    Age
    37
    Posts
    1,015

    Part III: (x)html and Css combined Chapter I : bulleted lists

    Introduction :
    The particularity of this is that now we learn new things in XHTML and CSS at the same time. The plan of our tutoriel could be summarized like this:
    • XHTML
    • CSS
    • XHTML & CSS, the combined power of these two languages.

    Oh, and just hold you know what I just did above? It's called a bulleted list, and that is what we'll learn to do in this chapter!

    It is not difficult to understand, and it makes a nice little chapter to start gently Part III will make it a little later.

    tho the result is the same i still didn't use xhtml property to make a bullted list, what i used is bbcode that apply on vbulletin forums,be aware of this, so u won't try bbcode on an xhtml page simply it won't work.



    Different types of lists (XHTML) :
    This chapter has the merit of being very clear in its construction: at first we learn to create bulleted lists with a view XHTML, and in a second step we will learn to decorate these lists of new properties via CSS . Firstly, we must know that there are 3 types of bullets:
    • Unordered lists
    • Ordered lists
    • Definition lists (rare)


    We'll see how it creates each of these bullets. It's easy, but be careful anyway because you'll need the bullets in the following chapters. Contrary to what one might think the bullets are used: they are particular to create the menu for your website!

    Unordered list

    an unordered list looks like this :
    • Strawberries
    • Raspberries
    • Cherries


    This system allows us to make a list of items, without any notion of order (there is no "first" or "last"). Create a bulleted list Unordered is very simple. Simply use the tag <ul> that it closes a little further with a </ul>,like this:
    <ul>....</ul>
    And now what we'll do: we'll write each element of the list between 2 tags <li> </li>. All these tags must be between <ul> and </ul>. You'll understand immediately with this example:
    <ul>
    <li>Strawberries</li>
    <li>Raspberries</li>
    <li>Cherries</li>
    </ul>
    <ul> </ul> indicates the start of a bulleted list
    <li> </li> indicates a new element of the bulleted list.

    You can put as many items as you want in the bulleted list, you're not limited to 3 units of course

    And now you know how to create a bulleted list Unordered!

    note: For those who need to make complex lists, know that you can nest bulleted lists (create a list to chip in a bulleted list). If you want to do this, open a second tag <ul> within an <li> </ li>
    If you close the tags in good order, it should not be a problem


    [URL="http://tutoriliez.eb2a.com/a.html"]see it here[/URL]

    ordered list :

    Already the bulleted list Unordered was a piece of cake ... Well there you'll realize that making a website is not so hard after all
    To make an ordered list,you just gonna changes the tag <ul> </ul> to replace it by <ol> </ol>

    Inside, it changes nothing: it still uses tags <li> </li>.

    The order in which you put the items in the list is important. The first <li> </ li> element will be No.1, the second will be the No.2 etc. ...

    <ol>
    <li> I get up </li>
    <li> I eat and drink </li>
    <li> I go back to bed </li>
    </ol>
    [URL="http://tutoriliez.eb2a.com/test25.html"]test code[/URL]


    Definition list :

    this 1 is different from previous examples. It's "a little" more difficult (but then frankly just a little bit ).
    The basic principle is the same. It indicates the beginning and end of the list with a tag. Here it is not <ul> nor <ol> but ... <dl> (it abriviation for "Definition List")
    let's see this first:

    <dL>

    </dL>
    Well, now the small difference is that we no longer use the tag <li> to indicate the different elements of the list.
    Indeed, in the case of a list of definitions, there are 2 different types of elements:
    • words
    • and their definitions

    The words are between <dt> </dt> , and the definitions between <dd> </dd>.
    The important thing to understand is that we must first put the word (<dt>), then its definition (<dd>). If you want to put a second definition, we must repeat: a dt and then a dd.
    <dl>
    <dt> Chat </dt>
    <dd> 4 legged animal that does "Meow!" </dd>
    <dt> Dog </dt>
    <dd> 4 legged animal that does "Woof Woof!" </dd>
    <dt> math teacher</dt>
    <dd> Alien came from another planet who teaches things that nobody understands </dd>
    </dl>
    [URL="http://tutoriliez.eb2a.com/test26.html"]test code[/URL]

    As you can see, the definitions are set slightly back from the words. It's not very pretty yet, but everyone knows that with a little help from CSS we can ensure that words are written in bold blue and definitions that are flashing red background. If you don't know how to do that in CSS, then get a fast look on Part II of the tutorial

    The elements of the bulleted list work in pairs here. Once you understand the need to type the first word and its definition, then you known how use the definition lists.



    list position :
    The first property that I want to show you is very easy to use. It lets you specify if we want the list to be indented or not.
    This property is called list-style-position, and can take 2 values:
    • inside: the list is not indented.
    • outside: the list is indented (default).


    see the example to get a better idea

    css code:
    .no_retreat
    {
    list-style-position: inside;
    }

    .retreat
    {
    list-style-position: outside;
    }
    [URL="http://tutoriliez.eb2a.com/test27.html"]test code[/URL]

    To see the difference in withdrawal, it is necessary that the elements of the lists contain at least 2 lines (that's why I put a <br />). In practice, it does not disable the removal of bullets, except when we use lists to create the menu of the website we'll see it later.

    Representation of the chip :
    Significantly more interesting the property list-style-type allows you to change the appearance of the chip. In fact, you do not have to have a chip in the form of round black, any more than you're required to have numbers for numbered lists (you can use letters a, b, c, d. ..)

    The property list-style-type can take many values. Some of them concern only unordered lists, the other concern only ordered lists:
    • For unordered lists (<ul>):
      1. disc: a black disk (default).
      2. circle: a circle.
      3. square: a square.
      4. none: no chip will be used.
    • For ordered lists (<ol>), the choice is vast:
      1. decimal: the numbers 1, 2, 3, 4, 5 ... (default)
      2. decimal-leading-zero: numbers starting with zero (01, 02, 03, 04, 05 ...).
      3. upper-roman: numbering Roman uppercase (I, II, III, IV, V. ..)
      4. lower-roman: numbering Roman lowercase (i, ii, iii, iv, v. ..)
      5. upper-alpha: numbering alphabetical uppercase (A, B, C, D, E. ..)
      6. lower-alpha: numbering alphabetical lowercase (a, b, c, d, e. ..)
      7. lower-greek: Greek numbering.

    There are actually other possible values for ordered lists, such as numbering Armenian, Georgian, Hebrew, Japanese, etc. ... But I will spare you (and I do not think you like me!), What I propose there should more than satisfy you

    And if we tested some of these bullets changed? Here is the XHTML code that will serve as a test (a little larger, but do not fear it's a bit repetitive, that's all:

    css code :

    /* unordered lists */

    .cercle
    {
    list-style-type: circle;
    }
    .square
    {
    list-style-type: square;
    }
    .nothing
    {
    list-style-type: none;
    }

    /* ordered list */

    .begin_with_a_zero
    {
    list-style-type: decimal-leading-zero;
    }
    .lowercase
    {
    list-style-type: lower-alpha;
    }
    .romans
    {
    list-style-type: upper-roman;
    }
    .greeks
    {
    list-style-type: lower-greek;
    }

    /* Some styles just for additional presentation
    In addition it makes you a few reminders */

    h2
    {
    text-indent: 20px;
    font-family: Arial, Verdana, "Times New Roman", serif;
    }
    em
    {
    background-color: yellow;
    }
    strong
    {
    color: red;
    }
    [URL="http://tutoriliez.eb2a.com/test28.html"]test code
    [/URL]

    Changing the image of the chip:


    If you don' like any of these chip representations above do, why not create your own? It is precisely what you offer the property list-style-image, which you can use any image
    instead of a chip.

    You need to tell it as value "url" followed address of the image to use. It works
    exactly like the background property (which allows specify a background image, if you remember
    good).

    One example will use a small image file to
    Instead of the chip, you'll see that it is
    much prettier

    css code :

    ul /* my lists will have files instead of the chips */
    {
    list-style-image:url("dossier.png");
    }

    /* just to ameliorate the resentation: */
    a
    {
    color:blue;
    text-decoration:none;
    }

    a:hover
    {
    text-decoration:underline;
    }
    [URL="http://tutoriliez.eb2a.com/test29.html"]test code[/URL]

    note :The image chip can be of any type (PNG, GIF or JPEG).
    Note, however, the image should not be too large otherwise it will be cutted. I recommend to use a size of about 15x15 pixels.


    wp, first chapter of the is over, fallow us for more xhtml css properties ,thx for reading nad have a nice day.
    Last edited by Arbalest; 12th March 2010 at 05:12 PM.

  2. #32
    the roXor <3 Arbalest's Avatar
    Join Date
    Jan 2008
    Location
    above
    Age
    37
    Posts
    1,015

    Inbox structure (1/2)

    Introduction :

    allright boys you're all in shape? Good, caus now this is it. Yes, till now you could follow my examples and invent some ofyour own, but you still can't make a full website.
    In these 2 chapters you will read will be a turning point in this Tutoriel: through them you'll create a good website, with design and everything! And those who have fear of being alone can rest assured I will not abandon you. I plan to show you all the way forward in a TP after this.

    The title of this chapter is quite suggestive, we will prepare to "box" our site, which means he will be ready soon!
    And, as i saw that some still didn't get the meaning of tags inline / block, I think a little reminder would not hurt ^^ .

    Block and Inline All the same !!!

    Throughout the previous chapters, you've heard many times the word "inline" and "blocks". I insisted that it was important to understand because everything would play on it later ...
    Well guess what, now that it all happens on this difference.

    It speaks of tags. Can be classified into XHTML tags one of the following 2 categories: inline and block
    What I expect from you is that you learn to recognize if a tag is inline or block.

    For example, <p> </p>?
    Yes, it is a block tag.
    And <a> </ a>?
    It is an inline tag.

    you're propably wondering how can i see the difference,well it's quiet simple
    • Block: a marker of type "block" on your web page automatically creates a new line before and after. Just imagine just a block. Your webpage will be made up of a series of blocks after each other. But you will see that in addition, it is possible to put a block inside another, which will significantly increase our opportunities to create the design of our site!
    • Inline: tag type "inline" is mandatory within a tag "block". An inline tag does not return to the line, the text is written inside so following the previous text on the same line (that is why we speak of tag " inline ").


    Does <p> </p> creates a new line?
    Yes, so it is a type tag block.
    Does <a> </ a> creates a new line?
    No, the text contained in this tag is written following the previous text, it remains on the same line. It is therefore an inline tag. see it's easy :P

    here some examples of block and inline tags:

    Block:
    • <p><p>
    • <blockquote>
    • <h1>
    • <h2>
    • <ul>
    • <ol>

    and Inline :
    • <em>
    • <strong>
    • <q>
    • <a>
    • <sup>
    • <img />


    and let's not forget our precious the <div>and the <span>
    • <span> </span> (inline): we have already used, if you remember. I used to show you some examples of CSS properties in the middle of a line. You remember the code below?

      xhtml code:

      <p> As stated <span class="name"> Neil Armstrong </span> a July 20, 1969 ...</p>
    • <div> </div> (block) : is also a tag that has no meaning, as span, except that there is block type. We will not use it wrong in the chapters that follow, particularly in creating the design of your site. You'll see a design, in fact, a series of blocks that has as one wants.


    Following the semantics!

    The universal tags are "very useful" certainly, but be careful not to abuse it. I want to warn you now: many webmasters make the <div> <span> too often, and forget that other tags are more appropriate.
    Here are 2 examples:
    • Example of a useless span
      I should never see in your code:
      <span class="important">
      ... Then there is the tag <strong> used to it!
    • Example of a div useless
      Similarly, this is completely absurd
      <div class="titre">
      ... since the tags are made especially for titles (<h1> <h2> <h3> ...)

    Yes, you are going to say that the final outcome (visual) is the same. I totally agree.
    But while the span and div tags do not mean anything in particular, the strong and h1 tags mean something! Strong means "important" and h1 means "principal".

    In XHTML, you are asked to use as possible of tags that make sense: it's called respect the semantics.
    The advantage is that if you follow this, your code will be a certain "logic". When the Google robot will list your site, "include" the meaning of tags and it will improve your position in the search engine

    got it? nice, let's get starting , moving on ^^



    We will yet work only on the tags of type "block".

    To begin, we focus on the size of blocks. Unlike an inline, a block has specific dimensions. It has a width and height.
    That makes, oh surprise, it has 2 CSS properties:
    • width: the width of the block. To express in pixels (px) or percentage (%).
    • height: the height of the block. Again, it is expressed in pixels (px) or percentage (%).

    By default, and it is very important to know, a block takes 100% of the available width. Look at this example code that uses no XHTML CSS property:
    i'll write anything in the paragraph just to make you see an example:

    [URL="http://tutoriliez.eb2a.com/test30.html"]test code[/URL]

    Nothing new about this example. However, it is important to note that subsection (as all the tags block) takes 100% of the available width by default.

    Now pimenton a little CSS to change the width of paragraphs. The following CSS said: "I want all my paragraphs have a width of 50%.

    css code:

    p {
    width: 50%;
    text-align: justify; /* Text justified to better see the width of the block */
    }
    [URL="http://tutoriliez.eb2a.com/test31.html"]test code[/URL]

    The rates will be useful to create a design that automatically adjusts to the resolution of the visitor.
    However, it may be that you need to create blocks with precise dimensions in pixels:

    css code :

    p{
    width: 250px;
    text-align: justify;
    }
    [URL="http://tutoriliez.eb2a.com/test32.html"]test code[/URL]

    see it's nice , you all saw the example? i guess yes, so how many of you noticed something not right in this? come on be honest
    then u'll say,you made the height to be 100px and the width to get 250px but still the the height looked even longer then the width.

    Yes, if the text is not enough space, the block will expand so that everything is visible. If you want to "cut" your paragraph to make it an exact size of 250x100, you'll need to use the CSS property overflow.
    The values that overflow can take are:
    • visible (default): If the text exceeds the size limits, the block is expanded so that everything is visible. This is what we have just seen.
    • hidden: If the text exceeds the limit, it will simply be cut. We can not see the text.
    • scroll: Again, the text will wrap if it exceeds the limits. Except that this time, the browser will create scroll bars so you could see all the text. It's like a frame within the page.
    • auto: mode "autopilot" . Basically, the browser decides whether or not to scroll bars (it will if necessary).


    let's see this in a 1 example :

    css code :

    p /* All paragraphs have these CSS properties */ {
    width: 250px;
    height: 100px;
    text-align: justify;
    } /* And each paragraph will have more value different overflow */
    .cut {
    overflow: hidden;
    }
    .scroll {
    overflow: scroll;
    }
    .auto {
    overflow: auto;
    }
    [URL="http://tutoriliez.eb2a.com/test33.html"]test code[/URL]

    In hidden, you can not see the entire text.
    With scroll, the browser has scroll bars vertical and horizontal (when we didn't need the horizontal bar).
    In auto, the browser has said "Bah, seems like i won't be needing the horizontal bar,so I'll remove it.
    In practice, you propably guessed it, the use of overflow: auto;
    The overflow will be very useful if you need to create "frames" within your webpage.

    Note: There is an old HTML tag, <iframe>, which gives roughly the same result. However, this tag is no longer valid in XHTML . therefore use an overflow instead.


    The CSS offers a wide choice of borders to decorate your page. So broad that there is a lot of CSS properties, and if I did you the complete list now you would know more exactly where to turn.
    So to go faster to the point, I decided to show you only the mega-property that contains everything. You remember a mega-property? Yes, we saw one: background, it was to the bottom of your web page. Go back to the relevant section if you need to refresh your memory on the mega-properties.

    Here, we will directly study the mega-property, because in practice this is often done.
    The mega-property in question, border. It has enabled us to indicate which edge is applied to the block.

    Like all mega-property that meets, you can save multiple values (here, there are 3 values to be used). You do not have to put all the values (you can get away with 2 or one), and the order in which you put these values does not matter.
    Remember this, because many people believe there is an order to respect and take the lead, then we totally do not care

    As I tell you, for border can use up 3 values to modify the appearance of the border:
    • Width: Specify the width of your border. Put a value in pixels (as 2px), or use one of the following keywords:
      • thin: thin border
      • medium: medium border
      • thick: thick border

      It is the browser chooses the number of pixels representing thin, medium and thick. In general, about the same on all browsers.
      Personally, I tend to use pixel values instead of "thin" and company ... But it is a matter of taste after all
    • Color: the color of your border. Use, as we have learned, or a color name ( "black", "red "...), is a hexadecimal value (# FF0000), an rgb value (rgb (198, 212, 37))
    • The type of edge: here you have lots of choices. Your border can be a simple line or dots, or dashes etc ... Here are the available values:
      • none: no border (default)
      • solid: a single line.
      • dotted: dots.
      • dashed: dashes.
      • double: double border.
      • groove: in relief.
      • ridge: 3D effect.
      • inset: another 3D effect (it looks that the block forms a hollow).
      • outset: another 3D effect (it looks that the block is raised).


    allright let's see how this looks like :

    css code :

    p
    {
    width: 300px; /* all paragraphs got 300px */
    text-align: justify; /* all paragraphs are justified */
    }

    .nothing
    {
    border: none;
    }
    .solid
    {
    border: 2px solid black;
    }
    .dotted
    {
    border: 2px dotted green;
    }
    .dashed
    {
    border: 2px dashed red;
    }
    .double
    {
    border: 4px double maroon;
    }
    .groove
    {
    border: 4px groove teal;
    }
    .ridge
    {
    border: 4px ridge fuchsia;
    }
    .inset
    {
    border: 3px inset black;
    }
    .outset
    {
    border: 3px outset black;
    }
    [URL="http://tutoriliez.eb2a.com/test34.html"]test code[/URL]

    get some test and hf with this i personaly think you guys should give it a try it's medium hard but it surely require to memorise it, so make your test boys and girls( if there is a girl reading this, hello sugar )

    At the top, right, left, bottom
    in the preview example getting the border all the same is not necessary you can have fun changing each 1 of them and to do that you gonna need these :
    • border-top: border at the top.
    • border-bottom: border bottom.
    • border-left: the left edge.
    • border-right: the right edge.

    They are also mega-properties, they function as border but not therefore apply to only one side.
    here Some borders tests.

    css code :

    p
    {
    width: 350px;
    }
    h2
    {
    border-bottom: 2px solid black;
    }

    .bottom_top
    {
    border-top: 1px dashed red;
    border-bottom: 1px dashed red;
    }
    .points
    {
    border-top: 3px dotted blue;
    border-left: 2px solid green;
    border-right: 2px solid green;
    border-bottom: 3px dotted blue;
    }
    .left_right
    {
    border-left: 6px solid black;
    border-right: 6px solid gray;
    }
    [URL="http://tutoriliez.eb2a.com/test35.html"]test code[/URL]


    Ah, the joys of margins
    This is not the time to fall asleep friends

    Understanding margins is vital. If you do not know precisely how the margins of the blocks, you will be annoyed when creating your design!

    All blocks have margins. What is important is knowing that there are 2 types of margins:
    • The padding
    • The outer margins


      Look carefully at this diagram(about the image since i sux in this i asked a friend to make it for me and i forget to tell him i want it in english so here a small traduction (marge intérieure= mean padding) and (marge extériure=mean the outer maring) the rest i guess it's clear ^^ ) :


      On this block, I put a border so that we better fix its banks.

      The space between the text and the border is the inner margin (green).
      The space between the curb and the next block is the outer margin (in red).

      In CSS, you can change the margin size with the 2 following properties:
      • padding: indicates the size of the padding. A general expression in pixels (px).
      • margin: indicates the size of the outer margin. Again, we use the most pixels.

      To see the margins, let's take a look at these 2 paragraphs to which I simply put a small border:

      css code :

      p
      {
      width: 350px;
      border: 1px solid black;
      text-align: justify;
      }
      [URL="http://tutoriliez.eb2a.com/test36.html"]test code[/URL]

      As you can see, there is no default padding (padding). However, there is an outer margin (margin). It is this margin is only 2 paragraphs are not stuck and that was the impression of "skip a line.

      Note : The default margins are not the same for all block tags. Try to apply this CSS to <div> tags that contain text, for example, you'll see that here there is no default padding or margin outside!

      let's Suppose I want to add a padding of 12px paragraphs:

      css code :

      p
      {
      width: 350px;
      border: 1px solid black;
      text-align: justify;
      padding: 12px;
      margin: 50px; /* 50px of outer margin */
      }
      [URL="http://tutoriliez.eb2a.com/test37.html"]test code[/URL]

      did you noticed? the marging was applied on all the 4 borders,well yeah, margin (as padding for that matter) applies to the 4 sides of the block.
      If you require a margin at the top, bottom, left and right, he'll have to use more specific properties ... And you'll see that the creators of CSS were not crushed, it works like border :
      • top: top
      • bottom: low
      • left: Left
      • right: right

      So you can find all the properties of the head.
      I'm going to give you a list of properties for margin and padding,so you get sure you got the subject.

      Here is the list for margin:
      • margin-top: the top outer margin.
      • margin-bottom: outer margin below.
      • margin-left: outer margin left.
      • margin-right: outer margin right

      And padding the list:
    • padding-top: padding up.
    • padding-bottom: padding below.
    • padding-left: padding left.
    • padding-right: padding right.


    i guess there is no need to make new examples here if u wanna test these news properties just make some modification on the previews tests
    allright then you guys made your tests? so how many actually noticed something familiar here?
    the bright once would say,( i noticed that the margin-left) and the (text-indent) we studied here gives the same result.
    wp, if you remember that, let's shift a bit as we had used a chapter in Part II of the text-indent property. Here, margin-left seems to give the same result ...
    Visually the result is the same, of course. If you put a border, you'll see a small difference: the left hand edge is offset with margin-left, while this is not the case with text-indent.

    In practice, I advise you to use the text-indent on paragraphs, to shift the first line. The rest of the time, play with the margin and padding to position the way you want your blocks.


    Center blocks
    It is quite possible to focus the blocks is very handy to create a design centered when you do not know the resolution of the visitor.

    However, very importantly, it works only if you specified a precise width (width) to block. If you have not specified a width, the block will not be centered!

    Take the case of our small paragraphs. They were already given a precise width, now if we want to focus on our screen we put the value "auto" at the margin property, like this:

    css code :

    p
    {
    width: 350px; /* we indicate width (necessary)*/
    border: 1px solid black;
    text-align: justify;
    padding: 12px;
    margin: auto; /* we can make the block centered with "auto" */
    margin-bottom: 20px;
    }
    [URL="http://tutoriliez.eb2a.com/test38.html"]test code[/URL]

    and like this, the browser automatically center our paragraphs. Remember, I said and I repeat, that the does not work if you defined a specific width for your block!
    all these theoretical concepts on the blocks are a little beard, I can understand.
    However, it is a necessary and (good news) is the last barrier before the creation of your website design. Basically, once you understand it, you can finally stand on your own.

    In short, it is more necessary than ever to pay attention. Especially since it is not over you still have to read the second part of this chapter.
    If I have good advice for you: do not hurry unnecessarily. Take time to be sure you understood everything. And above all ...
    make your tests
    that's it for now,thx for reading and see you on the next lesson.
    Last edited by Arbalest; 20th March 2010 at 02:58 PM.

  3. #33
    the roXor <3 Arbalest's Avatar
    Join Date
    Jan 2008
    Location
    above
    Age
    37
    Posts
    1,015

    Inbox structure (2/2)

    Introduction


    In the first part of this chapter "Canning"we toured the properties to CSS
    change the appearance and size of blocks. Forquickly summarize, we have seen:
    • How to change the size of blocks
    • How to change the border blocks
    • How to change margin blocks


    In this second part, we will learn to position. Bah oui, it going to have to learn
    say: "I want my menu or left, my content is right, there is the logo for my site
    top right 12 pixels from the right "etc. ...
    Whenever things are clear: the positioning inCSS is not obvious ... There is the theory, and there is practice.
    In this chapter we will see only the theory (it's a must).
    And in the next chapter we will practice (our promissed TP )

    One thing is for sure, and you should have you put it in your mind is that you can never have a site that appears similar to the pixel on all
    browsers. Instead, we learn to ensure that our website looks "almost correctly" on each of these browsers, and it is already something good to be satisfied with.




    I'll teach you pushing the laws of physics to change the laws of CSS .

    Images (<img />) are inline tags, and you prefer that they be blocks? No problem!
    Titles (<h1>) are of block type, and it has always bothered you, you prefer that it be inline tags? No problem!

    There is a very powerful CSS property, it is called display (to be handled with care, otherwise everything would fart :P )(j/k)


    In fact, display may take many values (that's a property to be powerful), but I'm willing to take you through and I just watch the 2 most used.

    To turn an inline tag in tag-type block, you'll need to type:


    display: block;

    For example, if I want ALL my images are of block type, then write this:

    css code :

    img
    {
    display: block;
    }
    note: by doing this doing this all your images will automatically go to the line, as do the other tags such block.


    Nothing impose that ALL your images are of block type, eh. I hope you have understood since the time: we may well use the class attribute on a tag for it to have a different presentation.

    For example:

    <img src="image.png" alt="this is a normale image(inline type)" />
    <img src="image.png" class="imageblock" alt="modified image(block type)" />

    .imageblock
    {
    display: block;
    }

    wp, that would be how to transform an inline into a block, you propably ask (so how do i make a block becoming an line)
    well it's simple, it still the work the only that you gonna modify is :

    .imageblock
    {
    display: inline;
    }
    that would do the work


    We'll learn here how to make an image float (which is of type "inline" I remind you). Here's the XHTML that we need to type in the first instance:

    <p><img src="../images/flash.gif" class="foating_image" alt="floating image" /></p>
    <p> This is a normal text paragraph, written in response to the image but it will surroound it caus the image is floating.<br />
    .floating_image
    {
    float: left;
    }
    [URL="http://tutoriliez.eb2a.com/test39.html"]test code[/URL]

    got it? good now let's start a small exercice about float:
    what i want from you, is to write a code that would make the first letter of the paragraph float like the preview image,i've showed everything you gonna need for it
    just be honest to yourself and try it on your own before looking at the correction (small hint you gonna need the property p:first-letter

    remember:you here there is a need of a particular use of font-size to change the size of the initial letter to make it say ... 3 row heights. For this, put the value "3em" (= 3 row heights), but if you type "300%" is just as good! by all means, it is better to avoid putting a value in pixels as "50px" because we do not know the size of a line (this may change).

    let's see what it looks like to give you a first impression of what your shoud do

    [URL="http://tutoriliez.eb2a.com/test40.html"]test code[/URL]

    p:first-letter /* I want the first letter of my paragraphs ... */
    {
    float: left; /* left float */
    font-size: 3em; /* make a height of 3 lines */
    font-family: Arial, Georgia, "Times New Roman", Times, serif; /* Either set in Arial if possible */
    font-weight: bold; /* Either written in bold (it's light) */
    margin-right: 5px; /* Whether there is a margin of 5px to the right so that it sticks too much to the rest of the text */
    }
    Do not stop there! Nothing prevents you from writing the initial cap in white on black background, or even use a background image! So give free rein to your imagination

    Stopping a float

    When you set up a float, the text "around", it has been understood.
    But what if you want that after a while the text continues below the float? It could be several <br /> following, but it is not practical nor clean...
    There is actually a CSS property (no kidding) who
    lets say: "Stop, this text should be below the
    floating and not next. "It's clear property
    which can roughly take 3 values:
    • left: text continues below after a float: left;
    • right: the text continues below after a float: right;
    • both: the text continues below, After a float: left; or after a float: right;


    For simplicity, we will use all the time clear: both, walking after a left-floating and
    after floating on the right (it works every time
    what).
    To illustrate its operation, we will take this code
    XHTML:

    <p> <img src="../images/flash.gif" class="floating_image" alt="float" /> </p>
    <p> This text is written next to the floating image. </p>
    <p class="under"> This text is written under the floating image. </p>
    css code:

    .floating_image
    {
    float: left;
    }
    .under
    {
    clear: both;
    }
    [URL="http://tutoriliez.eb2a.com/test41.html"]test code[/URL]

    wp, as you can see We apply a clear: both; paragraph that you want to see continue in the floating image, and voila!.



    Apart from floating, there are 3 ways to position a block in CSS:
    • Absolute positioning: it allows us to place a block anywhere on the page (top left, bottom right, at center ... etc.)
    • The fixed positioning: it's the same as absolute positioning, but this time the block is still visible, even if it falls further down the page. It's like the background-attachment: fixed; (if you remember yet)
    • Relative positioning: it is the most complicated of the three. Basically, it allows us to move a block from its normal position.


    Note: As for floating, absolute positioning, fixed and relative works on tags as inline <img />
    However, you will see it used more often on the block tags as inline tags.


    We must first make a choice between 3 modes of positioning available. For this, we use the CSS property position where we give one of these values:
    • absolute: absolute positioning.
    • fixed: fixed positioning.
    • Relative positioning relative.


    the absolute position :
    You know, to make an absolute positioning, you would type:
    position: absolute;

    But that's not enough!
    We said we wanted an absolute positioning, but should we say where we want the block is positioned on the page.
    To do this, we will call for the 4 CSS properties that i'm sure you already know them:
    • left: position relative to the left of the page.
    • right: position relative to the right of the page.
    • top: position relative to the top of the page.
    • bottom: position relative to the bottom of the page.


    You can give them a value in pixels, as "14px", or a percentage value like "50%".

    If it is not clear to some of you, this diagram should help you understand:




    With it, you should be able to properly position your block

    We must therefore use the position property and at least one of the 4 above properties (top, left, right or bottom). If we write for example:

    css code :


    position: absolute;
    right: 0px;
    bottom: 0px;
    ... it means that the block should be positioned at the bottom right (0 pixels from the right of the page, 0 relative to the bottom of the page).

    For once, we'll use the tag universal <div> (block type). I will write a paragraph, and I'll put in the block <div> two or three words:

    xhtml code:

    <p>
    this is some normal paragraph.<br />
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Integer vel libero. Cras dolor. Quisque quis odio eget justo pulvinar aliquet. Morbi luctus mi. Fusce leo. Integer eleifend condimentum felis. Phasellus vitae nibh. Mauris pellentesque porta magna. Quisque at turpis. Praesent semper odio eget risus. Praesent bibendum imperdiet massa. Quisque ac arcu ac augue dapibus vestibulum. Pellentesque gravida. Mauris turpis. Aenean molestie. Praesent at quam et ligula pellentesque luctus.
    </p>

    <div>positionned Block</div>
    [URL="http://tutoriliez.eb2a.com/test42.html"]test code[/URL]


    till now nothing extraordinary, you have a paragraph followed by a div block that contains some text. So far, nothing very exciting.
    Now add some CSS to position where you want to block our div:

    css code :

    div
    {
    background-color: yellow;
    border: 1px solid green;

    position: absolute;
    left: 35px;
    top: 50px;
    }
    [URL="http://tutoriliez.eb2a.com/test43.html"]test code [/URL]

    I putted a yellow background and a border for the better the block.

    As you can see, the block begins above paragraph and hide it. It is one of the major advantages and disadvantages at the same time of the absolute positioning: there is no control, you can save your block where you really want on the page, but be careful that it does not mask text.

    Here is another example to show that you can actually move the block anywhere:

    css code:

    div
    {
    background-color: yellow;
    border: 1px solid green;

    position: absolute;
    right: 50%;
    bottom: 20px;
    }
    [URL="http://tutoriliez.eb2a.com/test44.html"]test code[/URL]

    Note:A small technical detail for those who want to go further : If you place a block A in absolute, and that within this block you move to another block B in absolute, positioning, there will no longer be compared to the upper corner to the left of the window but from the corner at the top left of the block A.(hope you get it ,otherwise ask about it and i'll answer you)

    Ah ... The joys of CSS positioning

    the fixed position

    The operation is exactly the same as absolute positioning, except this time the block is fixed, even if you scroll down and up the block will remain in the same position.

    Instead of position: absolute; we will type position: fixed; in our CSS. As earlier, we help each other from top, left, right and bottom to place our block where you want on the page.

    The position: fixed; is particularly useful for a menu that remains visible:

    css code :

    div
    {
    background-color: yellow;
    border: 1px solid green;
    width: 150px;
    height: 250px;

    position: fixed;
    right: 40px;
    top: 60px;
    }

    p
    {
    width: 300px;
    }
    [URL="http://tutoriliez.eb2a.com/test45.html"]test code[/URL]


    the relative position
    a little hard to understand, the relative positioning . Personally, I do not use it much( i guess exampless will explain this more then words)
    Relative positioning is usually used to make "adjustments".

    Consider an important text, between 2 tags <strong>.
    To begin, I put on a red background so we can better identify:

    css code:


    strong
    {
    background-color: red; /* red background */
    color: yellow; /* text written in yellow */
    }
    [URL="http://tutoriliez.eb2a.com/test46.html"]test code[/URL]

    This time, the pattern that I showed you earlier for absolute positions and fixed no longer works. Why? Because the source has changed the coordinates (0, 0) is no longer in the top left of your window as was the case earlier. No, this time the source is in the top left of the current position of your item.

    Twisted is not it? Bah, yes, a relative position. This diagram should help you understand where the points of origin:


    So if you take a position: relative and you use one of the top, bottom, left, right, text on a red background will move from the position where it is located.

    I told you it was twisted in fact, must be tested to understand.
    Let us take an example: I want my text shifts of 55 pixels to the right and 10 pixels down. So I will ask it to be shifted by 55 pixels from the "left side", and 10 pixels from the "top edge"

    css code:

    strong
    {
    background-color: red;
    color: yellow;

    position: relative;
    left: 55px;
    top: 10px;
    }
    [URL="http://tutoriliez.eb2a.com/test47.html"]test code[/URL]

    At least you know what is the origin of a coordinate system (the coordinates 0, 0).
    Once we speak of absolute positioning, there is necessarily an origin ... This allows us to place a block (or even as an inline img tag) anywhere on the page!

    With this knowledge, then you are ready for more ...
    Moreover, what was it already? ... Ah yes! The result is a TP
    Indeed, the next chapter will not teach you anything new, but it is nevertheless get much of interest to you: I'll show you how to create the design of a site from A to Z with what you learned till now so see you soon

    note: xhtml/css tutoriel is almost over with the next chapter we would reached 70% of it all.
    Last edited by Arbalest; 28th March 2010 at 01:28 PM.

  4. #34
    the roXor <3 Arbalest's Avatar
    Join Date
    Jan 2008
    Location
    above
    Age
    37
    Posts
    1,015

    TD : The Website DESIGN from A to Z

    hell everyone for today's lesson we gonna create the design of your website
    As I doubt that for you is the first try to be careful. Creating a design,is not obvious task: it requires creativity
    , taste for color .

    so step by step i'm gonna guide into this ,so to get it started:
    get your head down and start typing, it's is something never to be done ^^
    when u start any kind of project you gonna need to to know the answer, the answer of HOW!!!

    You know now, a website is a combination of 2 files:
    • An XHTML file (. Html or. Htm): in this file is the content of the page (the text). This file consists of tags as <strong> used to indicate whether this text is important, if a paragraph or a quote ... etc.
    • A CSS file (. Css): is the file that creates the presentation of our web page. He said that a text is red, it is centered in the font "Arial" etc. ... In theory, CSS is optional. However, without CSS, our websites are ugly though

    If you followed me so far and you've done some testing, you know by what we start:
    First you type the page content (XHTML)
    And then we change the page layout (CSS)

    We will therefore follow that order.
    You will see the creation of XHTML is (very) quick and easy. However, we will spend more time on the CSS. Because it is difficult, there are a lot of CSS to know, and also because sometimes, we may well be a pro, the browser will not display things exactly as we wanted.

    Design fixed or expandable?

    A fixed design is a design whose width is fixed size (eg 800 pixels). There is usually a margin on the left and right, and the contents of the site is in the middle, it looks like this


    Expandable design is a design that expands automatically to the resolution of the visitor. If the visitor is 1024 * 768 design will have 1024 pixels wide. If the visitor is 1600 * 1200 there will be 1600 pixels wide.


    Personally, I tend to prefer designs stretch: I do not have an unused part of my screen.
    But you see when you tour the websites you visit regularly that many of them are still in design. Some people find it prettier, but I'll tell you the truth: it is also because it is easier to get it done

    so what kind of design we'll use?

    Well to be honest, the creation of a scalable design is fairly complex, and as this is your first design the expandable version still too complicated so We will undertake a design of fixed size, which is not so bad.
    Once you have improved and you have a little more experience, you can start creating a expandable design. You'll have time to get it done or maybe we'll do it at another occasion.

    allright then let's get it started.

    first, the xhtml page

    First step: we open our text editor (Notepad + + if you take the one I showed you at the beginning), and you create a new XHTML file.
    Go go ahead and do it at the same time as me!

    To begin, we will enter the code of "basis" of an XHTML page that I showed you in an earlier chapter. The are back again:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
    <head>
    <title>welcome in my website!</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>
    <body>

    </body>
    </html>
    As you know, we will write now only between <body> </body>.

    The general structure
    at this point often, the structured web pages use the blocks <div>, the famous Universal tag type "block" I told you about in previews lessons . We will usually have at least 4 blocks, presented as follows:


    At the top, the headers . This header usually contains the title of your site through banner.
    Below, you have the main part of your page with:
    • Left or right, the menu.
    • On the other hand, the body of the page, that is to say, the part that contains the text of your site.
    • Finally, there is usually at the bottom a "footer" in which it indicates the author's site, possibly his e-mail and copyright to a small class


    So much for the outline.

    In XHTML, it will create these 4 blocks with 4 different <div>:

    <div id="header">
    <!-- we put the banner here -->
    </div>

    <div id="menu">
    <!-- our precious menu ^^ -->
    </div>

    <div id="body">
    <!-- this is the main subject which for now will be a text. -->
    </div>

    <div id="footer">
    <!-- we put the author name, signature, maybe mail too by all means it depend on what u want... -->
    </div>
    Quite simply, we put a block <div> each major block of the page. We shall see now what we put into it.

    A feature that had to shock you: we use here id and not class as we have been accustomed to use so far. If you do not remember the difference between an id and a class, go back to the early chapters on CSS.

    Roughly speaking, an id and a class is almost the same thing, except you can not put an id once in a XHTML page, unlike the class that can be used several times. Few id in a page in general, there is especially for large "blocks" of design as we have done here.

    note: You must write your blocks in the order they are displayed (from top to bottom) in the XHTML code. First the header in the last footer.
    As for the menu and body that are at the same level, the order between them does not matter. It may change their position in the CSS (left menu, or right menu).


    noted?, Okay now what do we do? Well, we'll see more detail what we put into each of 4 <div>


    So that, it will be fast. In general, a header is just a banner (image), even for those who do not want to draw a simple title <h1> (site title).
    For my part, I'll put a banner(made by Cen), for example this 1:


    How to put this image in the <div> the header? It has 2 options:
    • Either you create a tag <img /> inside, to insert our banner. It's an easy way to insert an image, that we can.
    • Either we do not put anything inside the <div id="header"> and we will put the banner as a background picture later in the CSS.

    The second solution is not particularly difficult but a bit surprising I must confess. In fact, we will create a power "vacuum" that will be used only to display an image, and this image will be displayed by the CSS.
    The result is apparently the same as if we had used <img /> but we see at the end of this chapter that this technique will prove to be paid if you want to change the design of your site easily.

    <div id="header">

    </div>
    so we'll keep it empty between the div and the </div>


    In the block menu, we will have to create several sub-blocks (yes, it fits) to separate the different menu items.

    Look out the diagram below: it is a zoom on the block "Menu" scheme earlier:


    As you can see, it contains 2 sub-blocks that will serve as sub-menus.
    How this interlocking blocks? It's very simple XHTML:

    <div id="menu"> <!-- the main menu-->

    <div class="element_menu"> <!-- a sub-menu -->
    text of the 1st menu
    </div>

    <div class="element_menu">
    text of the 2nd menu
    </div>

    </div>
    Well, now are adding the text inside the menu to be like in the last diagram.
    We will put in each "element_menu" a menu title. Remember the tag that is used to make tracks? Yes, there are 6 tags (depending on the size of the title) of <h1> to <h6>. As the titles of menus are a bit smaller, I'll put them in <h3>.
    Then we will post a bulleted list (<ul>) to have a well organized menu.

    <div id="menu">

    <div class="element_menu">
    <h3>menu title</h3> <!-- title of the sub-menu -->
    <ul>
    <li>Link</li> <!-- list of links -->
    <li>Link</li>
    <li>Link</li>
    </ul>
    </div>

    <div class="element_menu">
    <h3>menu title</h3>
    <ul>
    <li>Link</li>
    <li>Link</li>
    <li>Link</li>
    </ul>
    </div>

    </div>
    In general, it is often bulleted lists for menus because it creates a good organization easily.
    You may have noticed that I marked "Link", but I did not put tag <a href="...">. It was just not too much clutter on the diagram, of course we will put links in our menu, otherwise it would not make much sense

    <div id="menu">

    <div class="element_menu">
    <h3>menu title</h3>
    <ul>
    <li><a href="page1.html">Link</a></li>
    <li><a href="page2.html">Link</a></li>
    <li><a href="page3.html">Link</a></li>
    </ul>
    </div>

    <div class="element_menu">
    <h3>menu title</h3>
    <ul>
    <li><a href="page4.html">Link</a></li>
    <li><a href="page5.html">Link</a></li>
    <li><a href="page6.html">Link</a></li>
    </ul>
    </div>

    </div>
    And here is a nice menu all while clean, with its sub-menus!
    You can, if you wish, add other sub-menus. There is no limit, but be careful not to take undue advantage of submenus or the visitor can easly get lost.
    Note: You are not required (although this is usually done) to put links and a bulleted list in a menu. If you want to write some text in it, use the paragraph tag <p></p>.


    The body is the main part of the page. That there will be ample content of your page.
    So, as I do not know what your site will speak, I can not tell you what you need: only you know

    I'll still give you some guidelines to help you get started.
    To begin, we'll put a title <h1> to be the main title of the page. In general, I put the same title in the <title> (in <head>) than in the tag <h1>.

    Then we write our paragraphs <p> possibly separated by subtitles <h2> for a little better structure its text

    This gives us a relatively simple code for the body:

    <div id="body">
    <h1> My super site </h1>

    <p>
    Welcome to my super site! <br />
    You'll love it here is a great site that will talk about ... er ... I'm still looking a little theme of my site:-D
    </P>

    <h2> to Who is this site adressed? </ h2>
    <p>
    To everyone! If I start to privilege some people, they will accuse me of discrimination o) <br />
    Whether you're fans of guns to drive plasma or Barbie and Ken, this site is for you! If yes!
    </P>

    <h2> Author </h2>
    <p>
    The author of the site? Well, that's me, what a question <br />
    I'll try to make the best site in the world <br />
    MooUUuUuuUAhahHaaAhAAaaah! (Diabolical laughter).
    </P>
    </Div>
    Do not mind the text I wrote i was just filling the blanks

    note: Remember that this area is clear. If you want to put pictures, links, other paragraphs, do it! It is the content of your site after all.


    As I have said, the footer is used to write the name of the author in general, and if you like you can put a copyright to class with your friends )

    <div id="footer">
    <p> Copyright Corporation" 2010, all rights reserved </p>
    </Div>
    Xhtml Final Code :

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
    <head>
    <title>My Super Website</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    </head>

    <body>

    <!-- Header -->

    <div id="header">

    </div>

    <!-- Menu -->

    <div id="menu">

    <div class="element_menu">
    <h3>menu title</h3>
    <ul>
    <li><a href="page1.html">Link</a></li>
    <li><a href="page2.html">Link</a></li>
    <li><a href="page3.html">Link</a></li>
    </ul>
    </div>

    <div class="element_menu">
    <h3>menu title</h3>
    <ul>
    <li><a href="page4.html">Link</a></li>
    <li><a href="page5.html">Link</a></li>
    <li><a href="page6.html">Link</a></li>
    </ul>
    </div>

    </div>

    <!-- Body -->

    <div id="bodys">
    <h1> My super site </h1>

    <p>
    Welcome to my super site! <br />
    You'll love it here is a great site that will talk about ... er ... I'm still looking a little theme of my site:-D
    </P>

    <h2> to Who is this site adressed? </ h2>
    <p>
    To everyone! If I start to privilege some people, they will accuse me of discrimination o) <br />
    Whether you're fans of guns to drive plasma or Barbie and Ken, this site is for you! If yes!
    </P>

    <h2> Author </h2>
    <p>
    The author of the site? Well, that's me, what a question <br />
    I'll try to make the best site in the world <br />
    MooUUuUuuUAhahHaaAhAAaaah! (Diabolical laughter).
    </P>
    </Div>

    <div id="footer">
    <p> Copyright Corporation" 2010, all rights reserved </p>

    </Div>

    </body>
    </html>
    Well I say: congratulations!
    You just made your first true XHTML page!

    I suspect that you have not guessed alone, but the main thing is that you understand and you follow along with me. There is no novelty in XHTML, you have learned all these tags.
    In addition, you must admit that XHTML is not that very long (it was much worse on the web a few years ago).

    However, it has not yet finished. In fact, an XHTML code like this all alone without CSS, it does not give something extraordinary, just don't forget we just got started

    [URL="http://tutoriliez.eb2a.com/test50.html"]test code[/URL]


    We address now the CSS part.
    This is a very important part because it is necessary that you understand how each line of code modifies the design.

    We will go there again very "step by step"

    note:As for you, if you want to understand you have any interest in trying to make some changes to the CSS. If an online upsets you, try to remove it simply and watch the results it produces. That's how I learned, and I think it's the best way, I invite you to do the same

    center the design

    To begin, we'll just work on the <body>. Yes, I know it's a tag on which we have not really worked so far, but the principle remains the same for CSS.
    <body>, I remind you, is the tag that includes the entire contents of your webpage. If we say that our <body> done so pixels wide (for design of fixed size) and we want the center (with margin: auto, bah was already practically won

    For the size of the page, I'll put 760 pixels. Why 760? Because it is less than 800px, and the visitors who are in resolution 800 * 600 will not have to move right to see the rest of the page.

    In terms of margins, a margin: auto suffice to focus the design.
    I'll add a top margin (top) and bottom (bottom) of 20 pixels to ensure that our page is too "stuck" with the top and bottom of the browser.

    Finally, I put a small background image (background-image) to the page to do a little less empty.
    this is how it's done

    body
    {
    width: 760px;
    margin: auto; /* to center the page */
    margin-top: 20px; /* o avoid sticking to the top of the browser window. Try removing and see! */
    margin-bottom: 20px; /* same thing just on bottom */
    background-image: url("images/fond.png"); /* A little background image to avoid having the old white background */
    }
    [URL="http://tutoriliez.eb2a.com/test51.html"]test code[/URL]


    Let me repeat: try to remove a few lines to see the result on the page:
    • If you remove the background (background-image), you will find a white base.
    • If you remove the margin-top or margin-bottom, you will see that your page will be a little too "stuck" with the edges of the page.
    • If you remove the margin: auto, your page will be more focused and will be found to the left. Note that the margin: auto does not work in IE 5: then these visitors will have a design on the left, but this is no big deal, believe me it gets worse



    the header

    As promised, we will post the banner of the site using the CSS (with background-image). It was something a bit new and seemingly silly just now: we have put anything in the <div> the header.
    It is a technique you can use if necessary to ensure that all your design is included in the CSS file. It will be very useful (among others) to create a site that offers several different designs.

    Now we must display our banner with only CSS:
    The first thing to do, if we want the banner is visible, it will expand the size of the block "en_tete" so that it can contain the full banner.
    As our banner is 758x100pixels, we will define a width and height of these dimensions:
    width: 758px;
    height: 100px;
    Then we will indicate what background image you want to put our big block which is currently empty:
    background-image: url ("images / banniere.png");
    Normally we have the background show up only once, but it does not cost us much to ensure that this image will not be repeated with mosaic background-repeat:
    background-repeat: no-repeat;
    Finally, it is but a detail so that the header is too stuck with what is found here (the menu and body), we will define a small margin-bottom (margin-bottom) few pixels:
    margin-bottom: 10px;

    this what it shows

    css code:

    bodys
    {
    width: 760px;
    margin: auto;
    margin-top: 20px;
    margin-bottom: 20px;
    background-image: url("images/fond.png");
    }


    /* L'en-tête */

    #header
    {
    width: 760px;
    height: 100px;
    background-image: url("images/banner.png");
    background-repeat: no-repeat;
    margin-bottom: 10px;
    }
    [URL="http://tutoriliez.eb2a.com/test52.html"]test code[/URL]


    From an empty block, we could display our banner only CSS. Now, if you want to change the banner on your site, it will change the CSS file and not the XHTML. And that's a good thing you'll realize why right away

    I remind those who might have forgotten:
    For a class, put a "[color=red.
    " (dot) before the name in the CSS.
    For an id, put a "#" (pound sign) before the name. Now, look at the XHTML code, "header" is an id![/color]

    The Menu
    It is a bit more difficult.
    We will have to place the menu on the left "of the body, while for the moment the menu is over.

    To do this, the technique most common and fastest is to use the CSS property float. It is a rather special property as we have seen, and it will be handy here to correctly position the menu and body.

    It will also give a size of 120 pixels on the menu, so that it is not too large.

    Then we'll work on our class "element_menu" (which corresponds to part of menu). We're going to put a background color a bit more dark gray, with a background image repeat-x (which is repeated horizontally only).
    Then we will add a border to each element of menu that people may see its limits. "2px" solid black it should be good.
    Finally, we will put a margin-bottom of each menu item to prevent them from being too glued to each other.

    body
    {
    width: 760px;
    margin: auto;
    margin-top: 20px;
    margin-bottom: 20px;
    background-image: url("images/fond.png");
    }

    /* header */

    #header
    {
    width: 760px;
    height: 100px;
    background-image: url("images/banniere.png");
    background-repeat: no-repeat;
    margin-bottom: 10px;
    }

    /* the menues */

    #menu
    {
    float: left; /* the menu will float at left*/
    width: 120px; /* IMPORTANT : give a width to your menu */
    }

    .element_menu
    {
    background-color: #626262;
    background-image: url("images/motif.png");
    background-repeat: repeat-x;

    border: 2px solid black;

    margin-bottom: 20px; /* make space so the links wont get too close */
    }
    [URL="http://tutoriliez.eb2a.com/test53.html"]test code[/URL]

    We will also add a left margin on the body (margin-left). We'll do that just now when we work on the body.
    If it can reassure you, it's a simple trick, yet I did not know there are still 5 minutes!
    ... How does it does not reassure you?

    Well, it has not yet finished working on the menus. We'll add some effects.
    I am not going to explain it in too much detail, it's simple, and it's just to improve the presentation.

    The main need to be understood here is that I am using "nested tags.
    Remember, when writing for example:
    . Element_menu ul
    ... it means "This CSS will affect the <ul> located within a element_menu.


    height: 100px;
    background-image: url("images/banner.png");
    background-repeat: no-repeat;
    margin-bottom: 10px;
    }

    /* the menus */

    #menu
    {
    float: left;
    width: 120px;
    }

    .element_menu
    {
    background-color: #626262;
    background-image: url("images/motif.png");
    background-repeat: repeat-x;

    border: 2px solid black;

    margin-bottom: 20px;
    }


    /* some effects on menu */


    .element_menu h3 /* all titles on the sub-menus */
    {
    color: #B3B3B3;
    font-family: Arial, "Arial Black", "Times New Roman", Times, serif;
    text-align: center;
    }

    .element_menu ul /* all bullted lists in the menu */
    {
    list-style-image: url("images/puce.png"); /* we change the bullted list appearance with an image */
    padding: 0px; /* no space between all internal margin */
    padding-left: 20px; /* ... but then changes the left margin, so this one will finally 20 pixels */
    margin: 0px; /* Same for margin, it saves us from having to write 4 (margin-left, margin-right...) */
    margin-bottom: 5px; /*Same as earlier, a change then just margin-bottom, but all others are to 0px */
    }

    .element_menu a /* all links inside the menu */
    {
    color: #B3B3B3;
    }

    .element_menu a:hover /* when u get the mouse above links */
    {
    background-color: #B3B3B3;
    color: black;
    }
    [URL="http://tutoriliez.eb2a.com/test55.html"]test code[/URL]

    see it already starting too like like a website

    The Body

    For the body, it will be important to define good margins.
    The problem we want to settle in priority is the body text that goes "under" the menu when it is too long. As I have explained, it is a normal behavior because it has a Float: left; on the menu.

    the awakened ppl between you guys would ask something like this :How to avoid that the text goes under the menu then?

    Just change the margin "left" of the body. It is an outer margin, so a margin-left.
    He puts a higher value to "push" the body on the right, so it spends more on the menu (so a value greater than the width of the menu). Here, for example, we'll put a value of 140px. Like magic, you'll see, the body will be properly placed!

    Let us not in so good way
    It will add a margin-bottom so that the footer below is not too "stuck" in the body:
    margin-bottom: 20px;

    We will also put a little padding (padding) on all sides so that the text does not fit too well with the edges of the body:
    padding: 5px;

    We will also put a background color, a small background image that repeats horizontally, a border ... In short, it's all decoration.

    body
    {
    width: 760px;
    margin: auto;
    margin-top: 20px;
    margin-bottom: 20px;
    background-image: url ("images/fond.png");
    }

    /* The header */

    # header
    {
    width: 760px;
    height: 100px;
    background-image: url ("images/banner.png");
    background-repeat: no-repeat;
    margin-bottom: 10px;
    )

    /* Menu */

    # Menu
    {
    float: left;
    width: 120px;
    }

    .Element_menu
    {
    background-color: # 626262;
    background-image: url ("images/motif.png");
    background-repeat: repeat-x;

    border: 2px solid black;

    margin-bottom: 20px;
    }


    /* Some effects on menus */


    . Element_menu h3
    (
    color: # B3B3B3;
    font-family: Arial, "Arial Black", "Times New Roman", Times, serif;
    text-align: center;
    )

    . Element_menu ul
    (
    list-style-image: url ("images/puce.png");
    padding: 0px;
    padding-left: 20px;
    margin: 0px;
    margin-bottom: 5px;
    )

    . Element_menu a
    {
    color: # B3B3B3;
    }

    . Element_menu a:hover
    {
    background-color: # B3B3B3;
    color: black;
    }


    /* The body of the page */

    # Bodys
    {
    margin-left: 140px; /* A line on the left to push the body so that it can not pass under the menu */
    margin-bottom: 20px; / * This is, to prevent the body glue too footer below */
    padding: 5px; / * To keep the text within the body does not stick too closely to the edge */

    color: # B3B3B3;
    background-color: # 626262; /* A background color for the body * /
    background-image: url ("images/motif.png");
    background-repeat: repeat-x; /* A small background image that is repeated across the top */

    border: 2px solid black; /* A border for marking the boundaries of the body and to make nice */
    }

    The Footer
    For the footer, nothing fancy or extraordinary, they are similar changes to the rest. You put a background color, it puts a border, we check if the margins we like ... Note that I do a "clear: both" to remove the floating effect of the menu. This ensures that the footer is well below the menu.


    #footer
    {
    padding: 5px;
    clear: both;

    text-align: center;

    color: #B3B3B3;
    background-color: #626262;
    background-image: url("images/motif.png");
    background-repeat: repeat-x;

    border: 2px solid black;
    }
    [URL="http://tutoriliez.eb2a.com/test56.html"]test code[/URL]

    This was our last CSS, the design is finished! (Whew)

    And this is our web site is ready. Now that the design is finished, you know how, what are the guidelines to follow. It's up to you to create the entire design of your site, put your colors, your background images, effects, fonts, ... etc.

    You are permitted (and encouraged) to inspire you to my CSS. I know it does not run when spring begins and we are submitting our first design, so I totally understand that all these lines of code will discourage you .
    The good news is that with practice you'll not only over the nausea, but mostly you'll create an entire design without help from anyone!

    oh yea one last thing i know it may sound silly but you may have already forgotten that our XHTML file appears with the format specified in the CSS, you must add the following line between <head> and </head>:

    <link rel="stylesheet" type="text/css" media="screen" title="Exemple" href="design.css" />

    Let the visitor choose the design
    One last thing I want to show you: the alternative style sheets.

    In fact, if you have several designs for your site (as is the case for me here), you can offer visitors to change a single stroke design.
    For this you must add tags <link /> between <head> and </ head>.

    In addition to the tag that I've recalled 2 minutes ago (which indicate the design "default" on your site), you could add the following line:
    <link rel="alternate stylesheet" media="screen" type="text/css" title="example" href="snd design.css" />

    This line indicates that there is an alternative style sheet . Visitors can choose the design of your site that pleases him.
    if you are using Firefox just go to the menu "View> Page Style" and choose the design you want.
    Note:Sites that offer alternative style sheets are rather rare. Many webmasters do not even know it exists, others got no enthousiam to make several designs
    You can put as many alternative style sheets as you wish. You will write a <link rel="alternate stylesheet" /> by different design that you propose.
    An example, and stop there:

    xhtml code:

    <head>
    <title> Welcome to my site </title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

    <! - The following design "default" page ->
    <link rel="stylesheet" type="text/css" media="screen" title="Mécanique" href="design_mecanique.css" />
    <! - The following alternative designs that you propose ->
    <link rel="alternate stylesheet" media="screen" type="text/css" title="2" href="2nd option.css" />
    <link rel="alternate stylesheet" media="screen" type="text/css" title="3" href="3th option.css" />
    <link rel="alternate stylesheet" media="screen" type="text/css" title="4" href="4th.css" />
    </Head>
    wp that was it, it took me some time to get the ideas ,get the whole plan of this but still as i said before i didn't abandon you guys , so see you in the next lesson there is just 3 lesson left to get this done so stay with us and see y on th next lesson
    Last edited by Arbalest; 18th April 2010 at 09:57 PM.

  5. #35
    Administrator Cen's Avatar
    Join Date
    Sep 2006
    Location
    Slovenia
    Age
    32
    Posts
    15,685
    Blog Entries
    2
    Is there still any interest from the public? Next step is to combine this whole html+css coverage with php and mysql. But it shall only be continued if someone actually has any use out of the tutorials.


    Regards

    //Arbalest, thank you :]

    Undefeated Mad Balls Arena champion

  6. #36
    the roXor <3 Arbalest's Avatar
    Join Date
    Jan 2008
    Location
    above
    Age
    37
    Posts
    1,015

    the Array

    Introduction

    Hello everyone,sry for being this late i was kinda busy lately anyhow with no further bs,where were we ah ye, we still have not finished with XHTML
    (And with the CSS, for that matter!)

    Of course, I want to reassure you that we have already
    the biggest and we're almost
    However, we still have some things to
    see. These are perhaps not the most important
    perhaps not the most used, but bet you that you'll need this sooner or later.

    Among those elements that I want you to discover
    , there are tables like this one :


    Well, it's a fairly primary. Of course, we learn to make more complex tables so that you can achieve everything you need.
    Again, Mr. CSS will pass and you will make your tables superclass in the blink of an eye. Good news from this side: there is not really new to learn CSS, you already know almost everything!
    so you propably guessed what make the table: A table is built using XHTML tags. Let's look at the basic structure ...

    First tag to know: <table> </ table>. This tag is used to indicate the beginning and end of a table.
    This tag is block type, so it should be placed outside of a paragraph like this.

    Xhtml code:

    <p> This is a paragraph before the table. </p>

    <table>
    <! - Here we will table content ->
    </Table>

    <p> This is a paragraph after the table. </p>
    you propably say what do i put inside the table?

    While there, be prepared to receive an avalanche of new tags
    To start slowly, here are 2 new tags very important:

    • <tr> </tr>: indicates the beginning and end of a table row.
    • <td> </td>: indicates the beginning and the end of the contents of a cell.


    In XHTML, your table is constructed row by row. In each line (<tr>), it indicates the content of individual cells (<td>).
    Basically, our table just now being built like this:


    It has a tag line (<tr>) which "surrounds" each cell (<td>)
    For example, if I want to make a table of two rows, with three cells per line (which means 3 columns), I will type this:

    xhtml code :

    <table>

    <tr>
    <td>Tim Berners-Lee</td>
    <td>55 years</td>
    <td>england</td>
    </tr>
    <tr>
    <td>Rafael Nadal </td>
    <td>23 years</td>
    <td>spain</td>
    </tr>
    <tr>
    <td>Manuel Schenkhuizen(grubby) </td>
    <td>23 years</td>
    <td>Netherlands</td>
    </tr>
    <tr>
    <td>marven(me xD) </td>
    <td>23 years</td>
    <td>france</td>
    </tr>
    </table>
    [URL="http://tutoriliez.eb2a.com/test59.html"]test code[/URL]

    yes the table got no borders and it almost like like 1 line
    Yes, a table without css doesn't look like 1 .that's precisely css is introduced to the subject,adding borders is an easy task and you already know the CSS code should be written!

    css code:

    td / * All table cells ... *
    {
    border: 1px solid black; / * ... have a border of 1px * /
    }
    [URL="http://tutoriliez.eb2a.com/test60.html"]test code[/URL]

    it still didn't give the result we expect. Indeed, we would like there is only one edge between two cells, but this is not the case here.

    Fortunately, there is a CSS-specific tables: border-collapse, which means "stick the edges between them."
    This property can take two values:

    • collapse: the edges are glued together, is the fact that research.
    • Separate: the borders are separated (default)


    css code:


    table
    {
    border-collapse: collapse; /* The table borders are glued (looks better)*/
    }
    td
    {
    border: 1px solid black;
    }
    [URL="http://tutoriliez.eb2a.com/test61.html"]test code[/URL]

    et Voila


    The row header

    Now that we have what we wanted, we will add the row header of the table. In our example, the headings are "Name", "Age" and "Country".
    The header row is created with a <tr> as has been done so far, but the cells are within this time <th> and not <td>!

    xhtml code :

    <table>
    <tr>
    <th>Name</th>
    <th>Age</th>
    <th>Country</th>
    </tr>
    <tr>
    <td> thierry henry </td>
    <td>32 years</td>
    <td>france</td>
    </tr>

    <tr>
    <td>Tim Berners-Lee</td>
    <td>55 years</td>
    <td>england</td>
    </tr>
    <tr>
    <td>Rafael Nadal </td>
    <td>23 years</td>
    <td>spain</td>
    </tr>
    <tr>
    <td>Manuel Schenkhuizen(grubby) </td>
    <td>23 years</td>
    <td>Netherlands</td>
    </tr>
    <tr>
    <td>marven(me xD) </td>
    <td>23 years</td>
    <td>france</td>
    </tr>
    </table>
    [URL="http://tutoriliez.eb2a.com/test62.html"]test code[/URL]

    As you can see, your browser has the text of the cell header in bold. This is what usually browsers do, but if you want you can change it at once from CSS: Change the background color of header cells, their police, their edges ... etc.
    we'll get into this later in this leson.



    Title of table

    Normally, any table must have a title. The title allows you to quickly inform visitors about the contents of the table.to define the table content how do we do that?
    well fortunately, there is the tag <caption> </caption> so with adding this our table become like this:

    Xhtml code:

    <table>
    <caption>herroes xDD :</caption>

    <tr>
    <th>Name</th>
    <th>Age</th>
    <th>Country</th>
    </tr>
    <tr>
    <td> thierry henry </td>
    <td>32 years</td>
    <td>france</td>
    </tr>

    <tr>
    <td>Tim Berners-Lee</td>
    <td>55 years</td>
    <td>england</td>
    </tr>
    <tr>
    <td>Rafael Nadal </td>
    <td>23 years</td>
    <td>spain</td>
    </tr>
    <tr>
    <td>Manuel Schenkhuizen(grubby) </td>
    <td>23 years</td>
    <td>Netherlands</td>
    </tr>
    <tr>
    <td>marven(me xD) </td>
    <td>23 years</td>
    <td>france</td>
    </tr>
    </table>
    [URL="http://tutoriliez.eb2a.com/test63.html"]test code[/URL]

    looks even more clear now

    note:Tim Berners-Lee is the guy who made first steps in html(we'll talk about him in the last lesson)

    We learned to make small, simple tables. These little pictures are sufficient in most cases, but it will happen that you need to make pictures more ... complex.
    We'll see two special techniques:
    For larger tables, it is possible to divide them into three parts:
    • Header of the table
    • Body of the table
    • Foot of the table

    For some tables, it is possible that you need to merge cells together.

    Let's start with the first point: you have a large table, and you have to divide it into several parts.

    Divide a large table
    If your table is big enough, you'll have every interest in cutting into several parts. For this, there are XHTML tags that identify the three "zones" of the table:
    • The header (top): it is defined with the tags <thead> </ thead>
    • The body (center): it is defined with the tags <tbody> </ tbody>
    • The foot of the table (below): it is defined with the tags <tfoot> </ tfoot>

    What to put in the foot of table? Generally, if it is a long table, you copy the cell header. It can even see the bottom of the table refers to what each column.

    Basically, a table is divided into 3 parts like this :

    xhtml code:

    <table>
    <caption>herroes xDD :</caption>
    <thead> <!-- header of the table -->
    <tr>
    <th>name</th>
    <th>Age</th>
    <th>Country</th>
    </tr>
    </thead>

    <tfoot> <!-- foot of the table -->
    <tr>
    <th>Name</th>
    <th>Age</th>
    <th>coutry</th>
    </tr>
    </tfoot>
    <tr>
    <th>Name</th>
    <th>Age</th>
    <th>Country</th>
    </tr>
    <tbody> <!-- body of the table-->
    <tr>
    <td> thierry henry </td>
    <td>32 years</td>
    <td>france</td>
    </tr>

    <tr>
    <td>Tim Berners-Lee</td>
    <td>55 years</td>
    <td>england</td>
    </tr>
    <tr>
    <td>Rafael Nadal </td>
    <td>23 years</td>
    <td>spain</td>
    </tr>
    <tr>
    <td>Manuel Schenkhuizen(grubby) </td>
    <td>23 years</td>
    <td>Netherlands</td>
    </tr>
    <tr>
    <td>marven(me xD) </td>
    <td>23 years</td>
    <td>france</td>
    </tr>
    </tbody>
    </table>
    [URL="http://tutoriliez.eb2a.com/test64.html"]test code[/URL]

    Note:It is not obligatory to use these three markers (thead, tbody, tfoot) on his table. Actually, you can use it especially if your table is big enough, and you need to organize more clearly
    For "small" tables you can keep the organization we saw at the beginning (much easier), there is no problem.


    Fusion

    in some tables, you'll need to "merge" between cells.
    One example of merger? Look, this table list of movies and shows to whom they are addressed:


    For the last film you see that the cells have been merged: they are one. This is exactly the effect we sought.

    To effect a merger, we must add an attribute to the <td>. You should know that there are two types of fusion:
    • merging columns: this is what I have done on this sample. The merger will take place horizontally.
      We will use the colspan attribute.
    • Merging lines: there, two lines will be grouped together. The merger will be carried vertically.
      We will use the rowspan attribute.


    As you know, you must give a value to the attribute (whether rowspan or colspan).
    This value is the number of cells to merge. In our example, we merged two cells: the column "Kids?" And of "For teens?". We will therefore write:

    <td colspan="2">

    Which means: "This cell is the fusion of two cells"
    It is possible to merge more cells at once (3, 4, 5 ... as many as you want).

    This is the XHTML code which allows me to realize the merger of earlier:

    xhtml code:
    <table>
    <tr>
    <th>title of the film</th>
    <th>for kids</th>
    <th>for adults</th>
    </tr>
    <tr>
    <td>SAW</td>
    <td >way to violent</td>
    <td>yes</td>
    </tr>
    <tr>
    <td>barbie</td>
    <td>yes</td>
    <td>don't think they'll watch</td>
    </tr>
    <tr>
    <td>avatar</td>
    <td colspan="2">for all family</td>
    </tr>
    </table>
    [URL="http://tutoriliez.eb2a.com/test65.html"]test code[/URL]

    Note: you see the last line contains only two cells instead of 3 (There are only two <td> tags).
    It is quite normal, because I merged the two
    last cells between them. The <td colspan="2">
    indicates that the cell takes the place of 2 cells
    time.

    That makes sense, isn't it?


    then come the rowspan :
    It complicates things a little bit. For our example, we will "reverse" the order of our table: instead of putting the film titles to the left, we will put them up.
    This is another way to see the table: instead of doing so in height, it can be long.

    Suddenly, the colspan is not adapted, it is a rowspan it do to say that avatar is for all the family.
    Take time to read and understand this example, it's worth taking a look at it.

    xhtml code :

    <table>
    <tr>
    <th>title of the film</th>
    <td>SAW</td>
    <td>barbie</td>
    <<td>Lucky avatar</td>
    </tr>
    <tr>
    <th>for kids</th>
    <td >way to violent</td>
    <td>yes</td>
    <td rowspan="2">for all family</td>
    </tr>
    <tr>
    <th>for adults</th>
    <td>yes</td>
    <td>don't think they'll watch</td>
    </tr>
    </table>
    [URL="http://tutoriliez.eb2a.com/test66.html"]test code[/URL]

    and with some css
    Then good news: you already know most of the CSS properties we need to embellish the table. Some examples:
    • To change the border cells, just use border.
    • To change the background color of a cell, use background-color.
    • To change the background image of a cell, use background-image
    • you can also change the size (font size) and police (font-family) of the cell header, using the properties tailored to <th> tags
    • You can also enlarge the whole picture (width) the center (margin: auto because the table is a block).
    • You can center the text inside cells (text-align: center), change the cell padding (padding) to ventilate the table.


    In short, you already know all these properties and I do not have to relearn them, it's a good thing
    The key is to think about them, and use the right tags. For example, if you put a background color to black tag <table> whole picture will be black. Whereas if you put the background color on the tags <th>, only cells header change!

    With nothing but known CSS properties

    [quote]

    Remember the table in three parts we managed to do just now? Let's review the code again:

    <table>
    <caption>herroes xDD :</caption>
    <thead> <!-- header of the table -->
    <tr>
    <th>name</th>
    <th>Age</th>
    <th>Country</th>
    </tr>
    </thead>

    <tfoot> <!-- foot of the table -->
    <tr>
    <th>Name</th>
    <th>Age</th>
    <th>coutry</th>
    </tr>
    </tfoot>

    <tbody> <!-- body of the table-->
    <tr>
    <td> thierry henry </td>
    <td>32 years</td>
    <td>france</td>
    </tr>

    <tr>
    <td>Tim Berners-Lee</td>
    <td>55 years</td>
    <td>england</td>
    </tr>
    <tr>
    <td>Rafael Nadal </td>
    <td>23 years</td>
    <td>spain</td>
    </tr>
    <tr>
    <td>Manuel Schenkhuizen(grubby) </td>
    <td>23 years</td>
    <td>Netherlands</td>
    </tr>
    <tr>
    <td>marven(me xD) </td>
    <td>23 years</td>
    <td>france</td>
    </tr>
    </tbody>
    </table>
    css code :

    caption /* title of the table */
    }
    margin: auto; /* Center the table title */
    font-family: Arial, Times, Times New Roman ", serif;
    font-weight: bold;
    font-size: 1.2em;
    color: # 009900;
    margin-bottom: 20px; /* To avoid that the title was too glued to the table below */
    }

    Table /* The table itself */
    {
    margin: auto; /* Center the table */
    border: 4px outset green / * Trim the table with 3D effect (outset) * /
    border-collapse: collapse; / * Glue the edges together * /
    }

    th /* The cell header */
    {
    background-color: # 006600;
    color: white;
    font-size: 1.1em;
    font-family: Arial, "Arial Black", Times, Times New Roman ", serif;
    }

    td /* Normal cells */
    {
    border: 1px solid black;
    font-family: "Comic Sans MS", "Trebuchet MS", Times, Times New Roman ", serif;
    text-align: center; / * All cells will be centered * /
    padding: 5px; / * Small padding cells to prevent the text touches the borders * /
    }
    [URL="http://tutoriliez.eb2a.com/test67.html"]test code[/URL]

    adding new css properties
    There are some new CSS properties that are specific to tables.
    Here are the ones I advise you to remember:
    • caption-side: indicates which should contain the title of the table. This property may take the following values:
    • top: the title will be placed on top of the table (by default).
    • bottom: the title will be placed in the bottom of the table.
    • left: the title will be placed to the left of the table.
    • right: the title will be placed to the right of the table.

      • border-collapse: we have already seen earlier, this property indicates that the cell borders are glued together. We often use this property because it provides the effect is interesting. The possible values are:
      • Separate: the borders will be separated from other (default).
      • collapse: the edges are glued together.

        • vertical-align: vertical alignment of the contents of a cell. If a cell has a considerable height, it is possible to place content on top, bottom or middle of the cell:
        • top: the content will be aligned at the top of the cell
        • middle: the content will be aligned in the middle of the cell
        • bottom: the content will be aligned at the bottom of the cell


    As is already known border-collapse, I'll just show you a CSS table that uses the vertical-align and the caption-side.
    I use the same files as XHTML and CSS just now, but I add in the CSS that the two properties just learned:

    css code:

    caption
    {
    caption-side: bottom; / * The title will be placed at the bottom of the table * /
    margin: auto;
    font-family: Arial, Times, Times New Roman ", serif;
    font-weight: bold;
    font-size: 1.2em;
    color: # 009 900;
    margin-top: 20px; / * The margin must be above and not below it now * /
    }

    table
    {
    margin: auto;
    border: 4px outset green;
    border-collapse: collapse;
    }

    th
    {
    background-color: # 006600;
    color: white;
    font-size: 1.1em;
    font-family: Arial, "Arial Black", Times, Times New Roman ", serif;
    }

    td
    {
    height: 80px; / * I will update the height of the cells so that we can see the vertical alignment * /
    vertical-align: bottom; / * vertical alignment, cell contents will be placed at the bottom * /
    border: 1px solid black;
    font-family: "Comic Sans MS", "Trebuchet MS", Times, Times New Roman ", serif;
    text-align: center;
    padding: 5px;
    }
    [URL="http://tutoriliez.eb2a.com/test68.html"]test code[/URL]

    The title is placed at the bottom of the table with caption-side.
    Small detail, I changed the margin-bottom of every hour in margin-top: yes, now that the title is in the bottom of the table, the room takes place above the title!

    To test the vertical alignment, I had to change the height of cells. In fact, for the vertical alignment is progress requires that the cells are sufficiently large.
    Then, the vertical-align allowed me to say "I want the text to be placed at the bottom of each cell"!

    wp that would be it with tables coming next forms, in the next lesson i'll show you how make buttons ,checkbox etc i'm pretty sure, that those whose interested in the subject would pretty much enjoy it, all-right guys thx for reading and see ya in the next lesson.
    Last edited by Arbalest; 15th May 2010 at 05:38 PM.

  7. #37
    Back in Life Mitsuki's Avatar
    Join Date
    Sep 2007
    Location
    Czech Republic
    Age
    39
    Posts
    3,508
    Quote Originally Posted by Cen View Post
    Is there still any interest from the public? Next step is to combine this whole html+css coverage with php and mysql. But it shall only be continued if someone actually has any use out of the tutorials.


    Regards

    //Arbalest, thank you :]
    I am reading it.

  8. #38
    Registered User Stormhunter's Avatar
    Join Date
    Aug 2009
    Location
    Hercegovina
    Age
    36
    Posts
    174
    Quote Originally Posted by Cen View Post
    Is there still any interest from the public? Next step is to combine this whole html+css coverage with php and mysql. But it shall only be continued if someone actually has any use out of the tutorials.
    /*Please continue i find it very enlighting */


  9. #39
    the roXor <3 Arbalest's Avatar
    Join Date
    Jan 2008
    Location
    above
    Age
    37
    Posts
    1,015
    Quote Originally Posted by Cen View Post
    Is there still any interest from the public? Next step is to combine this whole html+css coverage with php and mysql. But it shall only be continued if someone actually has any use out of the tutorials.


    Regards

    //Arbalest, thank you :]
    you're more then welcome thx
    Quote Originally Posted by Mitsuki View Post
    I am reading it.
    thx for the interest i'm flattered
    Quote Originally Posted by Stormhunter View Post
    /*Please continue i find it very enlighting */

    thx man

    i took a new job last 2 months that's why i didn't write much in last months, now it's settled , i already started writing the next lesson i think by friday it will be ready, and i guess since there is some interest in te subject i'll give a hand the in php/mysql tutoriel too again thx guys and see you soon

  10. #40
    Registered User Stormhunter's Avatar
    Join Date
    Aug 2009
    Location
    Hercegovina
    Age
    36
    Posts
    174
    Quote Originally Posted by Arbalest View Post
    you're more then welcome thx

    thx for the interest i'm flattered


    thx man

    i took a new job last 2 months that's why i didn't write much in last months, now it's settled , i already started writing the next lesson i think by friday it will be ready, and i guess since there is some interest in te subject i'll give a hand the in php/mysql tutoriel too again thx guys and see you soon


    I am just learning PHP on my collage pls by all means


  11. #41
    the roXor <3 Arbalest's Avatar
    Join Date
    Jan 2008
    Location
    above
    Age
    37
    Posts
    1,015

    The Forms :

    Introduction
    The time passes, guys. Over the tutoriel progresses, the more you'll see that start to reach the limits.
    hearing that you propably think that xhtml and css got limits, wel u're right aboutthat
    More seriously, yes XHTML and CSS have limits. You can already do a good site with everything I've learned, but imagine that one day you want to make a SUPER MEGA-site super cool?
    It happens. What I will tell you, it's always XHTML, but you will realize for yourself that you come to the "limits" of language.

    Ultimately, a good sign. It means perhaps that you have become good and that the XHTML is no longer enough

    What Will we speak in this chapter? , ah yea i almost forgot what was the theme of the day!
    We will discuss the forms. The idea is simple: you create a website, and would like for example that your visitors can give their opinion on it, by checking boxes, entering comments, suggestions ....

    Welcome to the wonderful world of forms, a world where the buttons, check boxes and dropdown lists live in harmony (well almost) xD .


    When you wanna insert a form in your XHTML page, you gonna have to use the tag <form> </form>. This is the main tag of the form, it indicates the beginning and end.

    xhtml code :

    <p>a text before the form</p>

    <form>
    <p>a text inside the form</p>
    </form>

    <p>a text after the form</p>
    Note :that you need to set the block type tags (like <p></p>) inside your form if you need to write text into it.

    So that was the basic structure.
    Now stay attentive, since we are at limit door of xhtml.

    Be aware that a form is made to be sent. Let's take an example that things are clear.
    Assume that your visitor comes to type a comment in your form, like "Wow your site is Coool". This message must be sent so that you can receive (logic isn't it), and so you know what visitors think of your site.

    Well this is the problem, or rather the problems that we will be asking:
    • Problem 1: how to send text entered by the visitor? By what means?
    • Problem 2: Once the data has been sent, how to treat? Would you like to receive the message automatically by email, or do you prefer a program to load the record somewhere, and then display it on a page visible to everyone?


    You must specify two attributes to <form> to give the answers to these two problems:
    • Method: This attribute indicates the means by which the data will be sent (problem # 1). There are two ways to send data on the web:
      • method="get": method is generally not very suitable, because it is limited to 255 characters. The peculiarity is that the information will be sent to the address of the page (http:// ...), but this detail does not really interest us at this time. Most of the time, I recommend you use another method: "post".
      • method="post": is the most widely used method for forms because it can get a lot of information through it.

    • Action: is the address of the page or program that will process the information (problem # 2). This page will load to send you an email with the message if that's what you want, or save the message with all others in a database.

    This can not be done in XHTML/CSS, you generally use another language you may have heard about: . (We will have the opportunity to come back to it once php/mysql tutoriel will start see this with cen).

    So we will now complete the <form> with two attributes we have just seen.

    For method, you guessed it I will put the value "post".
    For action, I'll type the name of a special page in PHP (traitement.php "). This is the page that will be called when the visitor clicks on the button "Send form".

    xhml code :

    <p>a text before the form</p>

    <form method="post" action="traitement.php">
    <p>a text inside the form</p>
    </form>

    <p>a text after the form</p>
    For the moment we do not know what is going on inside page "traitement.php" I ask you to trust me and imagine that this page is up and running. We will see later how this PHP page is to analyze form data, but it is not our priority.

    Our priority here is to see how XHTML / CSS is made to insert text boxes, buttons and checkboxes in your web page.
    This is what we gonna do

    Well, back to the concrete

    We'll see what XHTML tags that allow us to enter text into a form.
    To begin, we must know that there are two different text boxes:
    • a one lign text box : as its name suggests, you can not write a single line inside: P. It is used for entering short texts, such as: "Enter your username"
    • The multiline text box: This text box allows you to write a significant amount of text in multiple


    one lign text box

    To insert a text box to a line, we will use the <input />.
    We'll find her several times later in this chapter. Each time, it's type attribute that will change.

    For a text box to a line, you type: <input />


    But that's not all! It lacks an attribute that will be very important is the name of your text box. Indeed, this will allow you later (in PHP) to recognize that this text is the name of the visitor, such text is the password ... etc.
    So how to name this text box, thanks to the name attribute. Here, we assume that we ask the visitor to enter his username:
    <input name="login" />

    xhtml code :

    <form method="post" action="traitement.php">
    <p><input type="text" name="login" /></p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test100.html"]test code[/URL]

    Note: Remember to enclose your <input /> a block tag like <p></p> or else your web page will not be a valid xhtml page (i'll explain this in the next lesson "W3C and web standards").

    Labels
    that was nice , but if it falls on your visitor does not really know what to put inside. We'll just explain that he must enter his nickname.
    To indicate what is meant by a text box to the visitor, using the tag <label></label> surrounding the text, like this:

    xhtml code:

    <form method="post" action="traitement.php">
    <p>
    <label>your login</label> : <input type="text" name="Login" />
    </p>
    </form>
    But it is not enough. We need to link the label with the text box.
    To do this, we must give a name to the textbox, not with the name attribute but with the id attribute (which can be used on all the tags).

    you propably asking A name and an id on the field? It's not going to duplicate it?)
    well actually yes, Personally i give the same value to the name and id, it does not pose a problem.
    To link the label to the field, it must be given for an attribute that has the same value as the id of the field ...
    In global, it gives this:

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    <label for="login">your login</label> : <input type="text" name="login" id="login" />
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test101.html"]test code[/URL]

    Try clicking on the text "Your login" you will see that the cursor is automatically placed in the text box.
    It was "linked" with the label's text box so people know what it represents.

    actually most webmasters don't think about adding labels to their forms and sometimes the forms are so large and poorly constructed that it is difficult to know what goes with what and for sure, and they will thank you for taking the time to make your application clearer thanks to the labels.

    Some additional attributes:
    There are some other attributes on the <input /> certainly of interest to you.

    It is thus possible, if you need to give a default value to your text box.
    To do this, simply add the attribute value to <input /> indicating what value you want to initially. Example:
    <input name="pseudo" value="arbalest" />

    Another thing: you can change the width of your text box so that the maximum number of characters that can be put inside.
    The width is defined with size.
    The maximum number of characters is defined with maxlength.

    In the following example, the text box contains the nickname "arbalest" by default it is 30 characters long, but we can not put that up to 10 characters on the inside:

    <form method="post" action="traitement.php">
    <p>
    <label for="login">your Login :</label>
    <input type="text" name="login" id="login" value="arbalest" size="30" maxlength="10" />
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test102.html"]test code[/URL]


    Password Area

    You can easily make the text box behaves as an area "password", that is to say an area where you do not see the screen that is typed into it.
    The only thing you need to change is the type attribute <input />, Set type="password", and voila!

    I complete my form. He now asks the visitor's login and password

    xhtml code :
    <form method="post" action="traitement.php">
    <p>
    <label for="login">Your login :</label>
    <input type="text" name="login" id="login" value="arbalest" />

    <br />
    <label for="pass">your password :</label>
    <input type="password" name="pass" id="pass" />

    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test103.html"]test code[/URL]

    a multiline text box
    It arrives (finally) multiline text boxes. Do not worry, it will go faster now that you know the labels.

    The multiline text box is a tag exists in pairs (unlike <input />). This tag <textarea> </textarea>
    To this 1 also, like any other form element, you must give it a name with the name, and use a label that explains what it is.

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    <label for="improve">tell us your opinion about our site ?</label><br />
    <textarea name="improve" id="improve"></textarea>
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test104.html"]test code[/URL]

    You can change the size of textarea in two ways:
    • In CSS: just apply the CSS properties width and height to the textarea.
    • With attributes, you can add rows and cols attributes to the tag <textarea>. The first indicates the number of lines in the textarea, and the second the number of columns.


    like this:

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    <label for="improve">Comment pensez-vous que je pourrais améliorer mon site ?</label><br />
    <textarea name="improve" id="improve"rows="10" cols="50"></textarea>
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test105.html"]test code[/URL]

    if noticed we started the textarea just to close it right after it,we still type some text between them and In fact, it used to pre-populate the textarea. It's a little of what was earlier with value, except that here we can do it on multiple lines
    You can put the default value of textarea like this:

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    <label for="improve">tell us your opinion </label><br />
    <textarea name="improve" id="improve"rows="10" cols="50">give us your opinion about the website what you think we should add ^^</textarea>
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test106.html"]test code[/URL]

    In addition to entry areas, XHTML gives you a string of elements of options to use in your form.
    We will see in this part:
    [list][*]Check boxes, you probably know ...[*]Areas of options, you know that too ...[*]options list, you already have seen ... Well in fact you already know everything

    Or rather, you've seen all these things, but I bet you do not know how they are created in XHTML!
    I won? hehe I am definitely too strong xDD

    Checkbox
    the good news is that it's gonna be fast
    Indeed, using the tag you already know: it <input />
    It will only change the value of its type attribute set to "checkbox" like this <input type="checkbox" name="choice" />
    you add label and wp it's done

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    what you like to eat :<br />
    <input type="checkbox" name="chips" id="chips" /> <label for="chips">chips</label><br />
    <input type="checkbox" name="steak" id="steak" /> <label for="steak"></label><br />
    <input type="checkbox" name="spinach" id="spinach" /> <label for="spinach">spinach</label><br />
    <input type="checkbox" name="banana" id="banana" /> <label for="banana">banana</label>
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test107.html"]test code[/URL]

    so what's up with this:
    Thanks to the label, you do not have to click on the box, you can also click on the text next to (well, it does not work on IE as I told you at least ie6 and bellow).
    Do not forget to give a name to each checkbox, this will allow you to identify later what the visitor has checked boxes.

    Oh yes, I almost forgot. You can make a box is already checked by default. To do this we must add the attribute checked="checked" (yes, the same attribute and value).

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    what you like to eat :<br />
    <input type="checkbox" name="chips" id="chips" checked="checked" /> <label for="chips">chips</label><br />
    <input type="checkbox" name="steak" id="steak" /> <label for="steak">steak</label><br />
    <input type="checkbox" name="spinach" id="spinach" /> <label for="spinach">spinach</label><br />
    <input type="checkbox" name="banana" id="banana" /> <label for="banana">banana</label>
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test108.html"]test code[/URL]

    option area (Radio)
    Areas of options allow you to make a choice (and only one) from a list of possibilities:
    It looks like check boxes, with just a little further difficulty, you'll see.

    The tag to use is always a <input />, this time with the value "radio" for the type attribute.
    The big difference with the checkboxes is that the areas of options can be "group". A whole group of options has the same name, but a value attribute different each time.

    Things will be clearer in the example below:

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    indicate your age here:<br />
    <input type="radio" name="age" value="lessthen15" id="lessthen15" /> <label for="lessthen15">less then 15 years</label><br />
    <input type="radio" name="age" value="medium15-25" id="medium15-25" /> <label for="medium15-25"> i'm bettween 15-25 years</label><br />
    <input type="radio" name="age" value="medium25-40" id="medium25-40" /> <label for="medium25-40">i'm between 25-40 years</label><br />
    <input type="radio" name="age" value="morethen40" id="morethen40" /> <label for="morethen400">i'm even older then 40 years</label>
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test110.html"]test code[/URL]

    Why have the same name for each option? Simply so that the browser knows what "group" button is.
    Try removing the name attributes, you will see that each element of option will become selectable. But this is not what we want, that's why they are "binding" them by giving them the same name.

    Note:You will notice that this time we chose a different name herein. In fact, the name being the same, we could not distinguish them (and you know that id must be unique!). That is why we chose to put the same value as the id value.

    If you have two areas of different options should be given a unique name to each group as follows:

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    plz indicate your age:<br />
    <input type="radio" name="age" value="lessthen15" id="lessthen15" /> <label for="lessthen15">less then 15 years</label><br />
    <input type="radio" name="age" value="medium15-25" id="medium15-25" /> <label for="medium15-25"> i'm bettween 15-25 years</label><br />
    <input type="radio" name="age" value="medium25-40" id="medium25-40" /> <label for="medium25-40">i'm between 25-40 years</label><br />
    <input type="radio" name="age" value="morethen40" id="morethen40" /> <label for="morethen400">i'm even older then 40 years</label>
    </p>
    <p>
    in what continent do you live?<br />
    <input type="radio" name="continent" value="europe" id="europe" /> <label for="europe">Europe</label><br />
    <input type="radio" name="continent" value="Africa" id="Africa" /> <label for="Africa">Africa</label><br />
    <input type="radio" name="continent" value="asia" id="asia" /> <label for="asie">Asia</label><br />
    <input type="radio" name="continent" value="america" id="america" /> <label for="america">america</label><br />
    <input type="radio" name="continent" value="australia" id="australia" /> <label for="australia">Australia</label>
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test111.html"]test code[/URL]

    If you want one of the options is checked by default, you add a checked="checked" as for check boxes, and voila!

    Options list

    The options list is another elegant way to make a choice between several possibilities:

    This time, it works a little differently. We will use the tag <select> </ select> which indicates the beginning and the end of the list box.
    It adds the name attribute to the tag to give a name to the list. For example "country":
    <select name="pays">

    And now, inside the <select> </select>, we will put multiple tags <option> </option> (one for each choice).
    We add a value attribute to be able to identify what the visitor has chosen.
    i'm sure this sounds familiar since it's made the same way as the bullted list the <ul>and <li>..

    The principle is a bit different from what we've seen so far, but it is nonetheless understands very well.

    Also new, we can not use checked = "checked" here, we must instead use the ... selected = "selected". It allows us to select checked as a default:
    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    <label for="pays">in which country do you live ?</label><br />
    <select name="country" id="country">
    <option value="france"selected="selected">France</option>
    <option value="spain">spain</option>
    <option value="italy">Italy</option>
    <option value="united kingdons">united kingdons</option>
    <option value="canada">Canada</option>
    <option value="u.s.a">u.s.a</option>
    <option value="china">China</option>
    <option value="japan">Japan</option>
    </select>
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test112.html"]test code[/URL]

    But the list of options can do even better!
    You can create groups of options within the list, thanks to the tag <optgroup> </optgroup>. You need to add the label attribute that allows you to name the group (not to be confused with the tag <label>!).

    In our example, why not separate countries according to their continent?

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    <label for="country">in which country do you live ?</label><br />
    <select name="country" id="country">
    <optgroup label="Europe">
    <option value="france">France</option>
    <option value="spain">spain</option>
    <option value="italy">Italy</option>
    <option value="united kingdoms">united kingdoms</option>
    </optgroup>
    <optgroup label="America">
    <option value="canada">Canada</option>
    <option value="u.s.a">.s.a</option>
    </optgroup>
    <optgroup label="Asia">
    <option value="china">China</option>
    <option value="japan">Japan</option>
    </optgroup>
    </select>
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test113.html"]test code[/URL]

    It is quite useful, especially when you have a a large options list.



    Now we will try to go even further.
    Our goal is twofold: to ensure that our form is available (= understand) and design (= not too bad: - °)

    We will do this in three steps:
    1. Set a tab order (accessibility)
    2. Set shortcut keys (accessibility)
    3. Organize the form into several areas (accessibility and design)


    Set a tab order

    This is the first of the points that we expected to see our lives easier.
    As you may know, we can move in one form only through the "Tab" key (tab) to the left of your keyboard. Each time you press Tab, you go to the next field. Every time we do Shift + Tab, you return to the previous field.

    The goal is to tell in what order in XHTML it must move in the form. For example, after the field "name" if I hit Tab I must fall on the field "name", then "email" etc. ...

    We will use the tabindex attribute that can add all the tags of the form that has learned.
    He should be put to a number value. Each form field should have a different number.
    The numbers indicate the order in which it moves in the form: first, the No. 1 and No. 2, No. 3, etc. ...

    Note:You do not have to put numbers in sequence. It is even advisable to leave "spaces" between the numbers in case you need to add more fields later.
    Thus, it is quite possible to have 10 by 10: No. 10, No. 20, No. 30 etc ... It does not cost any more to count from 10 to 10, and if later we need to create a field No. 25, you shouldn't have a problem in this
    .

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    <label for="Name">what's your name ?</label><br />
    <input type="text" name="name" id="name" tabindex="10" /><br />

    <label for="mail">what's your mail adress ?</label><br />
    <input type="text" name="mail" id="mail" tabindex="20" /><br />

    <label for="country">in which country do you live ?</label><br />
    <select name="country" id="country" tabindex="30">
    <optgroup label="Europe">
    <option value="france">France</option>
    <option value="spain">spain</option>
    <option value="italy">Italy</option>
    <option value="united kingdoms">united kingdoms</option>
    </optgroup>
    <optgroup label="America">
    <option value="canada">Canada</option>
    <option value="u.s.a">.s.a</option>
    </optgroup>
    <optgroup label="Asia">
    <option value="china">China</option>
    <option value="japan">Japan</option>
    </optgroup>
    </select>
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test114.html"]test code[/URL]

    Try typing several times in a row "Tab", you will see that you will move in the order you
    have defined with tabindex.
    This is particularly useful for people who do not want or can not use a mouse (yes, it exists!).


    Set shortcut keys

    A shortcut key ("access key" in English) is a button that allows direct access to a field
    your form without having to click with the mouse and without having to keep pressing "Tab"
    frantically before falling on the field that you interest.

    This is very convenient, is that XHTML allows you to select which keys will serve
    shortcuts.
    What is less clear is that the shortcuts are used differently depending on the browser:

    • Firefox and Internet Explorer(Windows): it must be the Alt + shortcuts. If it does
      not work, try Shift-Alt Shortcut.
    • Safari and IE-Mac (Macintosh): you must enter Ctrl + Shortcut.

    To define a shortcut, you can use accesskey attribute, like tabindex can get
    on all types of form fields have been seen.
    You have to put value as the keyboard
    to serve as a shortcut to the field.

    In this example, the search field is available directly with the 3 button:

    xhtml code :

    <form method="post" action="traitement.php">
    <p>
    <label for="nom">whay's your name ?</label><br />
    <input type="text" name="name" id="name" tabindex="10" /><br />

    <label for="email">what's your mail ?</label><br />
    <input type="text" name="email" id="email" tabindex="30" /><br />

    <label for="recherche">What are you looking for on this site ? <em>(raccourci : 3)</em></label><br />
    <input type="text" name="searching" id="searching" tabindex="40" accesskey="3" />
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test115.html"]test code[/URL]


    On Windows, it must therefore be Alt + 3 to get directly to the search box.
    Mac, you have to Ctrl + 3 .

    Note:The biggest problem of shortcut keys is that some characters are already used by the browser. If you use the same there will be conflict and your visitors can no longer use the shortcuts to which they are accustomed.
    The ideal is to use numbers in a nutshell, they are usually used by very few browsers
    .

    oh ya 1 last thing Be sure to indicate somewhere on the page what are shortcuts used because your visitors will not guessit


    Organize the form into several zones

    so what's the idea about this?

    If you have a form quite large (and usually it will), it is easy for visitors to get lost in the mass of information he has to go. It is possible to group several fields XHTML with a theme between them.

    We will use the tag <fieldset> </fieldset> to delimit a group of fields.
    Inside this tag, you put your fields (your <input /> among others ...) and another tag: <legend> </legend>. This can give the name of the group.

    got the idea? then you propably noticed something :

    it got almost the same theory according to <optgroup> we just saw this ... But why just now used a attribute (label) to give a title to the group, and here we use a special tag <legend> x)

    let's take a look at it in this example :

    <form method="post" action="traitement.php">

    <fieldset>
    <legend>Your details</legend> <!-- title of the fieldset -->


    <label for="name">what's your name ?</label><br />
    <input type="text" name="name" id="name" tabindex="10" /><br />

    <label for="email">what's your mail ?</label><br />
    <input type="text" name="email" id="email" tabindex="20" /><br />
    </fieldset>

    <fieldset>
    <legend>your desire</legend> <!-- title of the fieldset -->

    <p>
    what's your biggest desire :<br />
    <input type="radio" name="desire" value="rich" id="rich" tabindex="30" /> <label for="rich">being rich</label><br />
    <input type="radio" name="desire" value="famious" id="famious" tabindex="40" /> <label for="famious">become famious</label><br />
    <input type="radio" name="desire" value="smart" id="smart" tabindex="50" /> <label for="smart">become even <strong>much</strong> more smarter</label><br />
    <input type="radio" name="desire" value="other" id="other" tabindex="60" /> <label for="other">other things...</label><br />
    </p>

    <p>
    <label for="precisions">if "other things", would you like to tell us what? :</label><br />
    <textarea name="precisions" id="precisions" cols="40" rows="4" tabindex="70"></textarea>
    </p>
    </fieldset>
    </form>
    [URL="http://tutoriliez.eb2a.com/test116.html"]test code[/URL]

    wp remain now the press the send(ok) button

    We're almost there.
    We've seen most of the elements that can be integrated in a form, but it misses the most important: the submit button!

    Fortunately, it's very easy to create, especially since you already know the tag ...yes it's the <input />

    Well, of course only one type of button was not enough for webmasters (too good to be true xDD ), it was necessary to create 3:

    • The submit button: it triggers the form submission. Visitors find themselves automatically teletransporting the page indicated in the action attribute of the form (we saw at the beginning of this chapter).
      A submit button is created with the attribute type = "submit". You can add a value attribute to change the text inside the button, but you can leave the default, it is also clear:
      <input type="submit" />
    • The reset button: it automatically resets all the form values. We must use this time attribute type = "reset"
      <input type="reset" />
    • The button-used-to-nothing: it is a button "generic" which does nothing special. The form is not sent, it does not reset, no nothing happens.
      What interest? It will serve mainly to run scripts written in Javascript (another language that can be used on a web page, yes I know it is a lot of languages). We, we will not use it, but I will talk to you know it exists if you need them one day.
      This time, I recommend you set the value attribute for it is known what is the button:
      <input type="button" value="i-do-nothing" />


    xhtml code :

    <form method="post" action="traitement.php">

    <fieldset>
    <legend>Your details</legend> <!-- title of the fieldset -->


    <label for="name">what's your name ?</label><br />
    <input type="text" name="name" id="name" tabindex="10" /><br />

    <label for="email">what's your mail ?</label><br />
    <input type="text" name="email" id="email" tabindex="20" /><br />
    </fieldset>

    <fieldset>
    <legend>your desire</legend> <!-- title of the fieldset -->

    <p>
    what's your biggest desire :<br />
    <input type="radio" name="desire" value="rich" id="rich" tabindex="30" /> <label for="rich">being rich</label><br />
    <input type="radio" name="desire" value="famious" id="famious" tabindex="40" /> <label for="famious">become famious</label><br />
    <input type="radio" name="desire" value="smart" id="smart" tabindex="50" /> <label for="smart">become even <strong>much</strong> more smarter</label><br />
    <input type="radio" name="desire" value="other" id="other" tabindex="60" /> <label for="other">other things...</label><br />
    </p>

    <p>
    <label for="precisions">if "other things", would you like to tell us what? :</label><br />
    <textarea name="precisions" id="precisions" cols="40" rows="4" tabindex="70"></textarea>
    </p>
    </fieldset>
    <p>
    <input type="submit" /> <input type="reset" />
    </p>
    </form>
    [URL="http://tutoriliez.eb2a.com/test117.html"]test code[/URL]

    wp that's pretty much it of course you can add some design in css to make it brighter ,add some colors center the form it self, well that i leave it to your imagination you already got what you need .

    the tutoriel is over but there is still a need for closure which will be the next 1. i'll be posting it later
    Last edited by Arbalest; 26th June 2010 at 09:03 AM.

  12. #42
    Administrator Cen's Avatar
    Join Date
    Sep 2006
    Location
    Slovenia
    Age
    32
    Posts
    15,685
    Blog Entries
    2
    Preety much everything you need to know about forms. How to actually have any use of data that you gather from forms is a story that will be told in the PHP part. For HTML, that's all you need to know. I mean, ALL. Good job.

    Undefeated Mad Balls Arena champion

  13. #43
    the roXor <3 Arbalest's Avatar
    Join Date
    Jan 2008
    Location
    above
    Age
    37
    Posts
    1,015

    wc3 and the web standards

    The history of the web

    We'll start with the basic knowledge: the history of the web. Any webmaster should know how long the web exists and what is its story.
    ,so when you will appear a little less stupid when you talk to the web with your friends webmasters xDDD , allright let's get started

    • It started in early 70s, during a meeting at the Government Printing Canada. A certain William Tunnicliffe proposed separating the information content (the text) and the display. Even then, when the Internet was reserved for only a very few privileged people spoke of separating the contents (which has now become the XHTML) from the formatting (which became the CSS).
    • Things accelerated in 1978, people have come together to create a "computer language standard" rich and scalable.
    • In 1986, SGML finally was born. It is the abbreviation of Standard Generalized Markup Language.it was a powerful language, but too complex . its documentation included 1290 pages! Not enough to motivate the public to use ... SGML didn't reach glory
    • In 1991, a certain Tim Berners-Lee(i told you before we gonna speak about him) invented the World Wide Web (WWW abbreviation). To create the first web pages, Tim Berners-Lee created HTML, which inspired a bit of SGML .
      (HTML stands for HyperText Markup Language) is distributed for free (thank you Tim!).



    • Barely two years later, one of the first free browsers appears: it is called Mozaïc and runs on both Mac and PC.
    • Between 1993 and 1994, the number of websites increased from 500 to 10 000, the growth is enormous. Already, the Web seems to be promised a great future.
    • It was in Europe that things start to rush. The Web is experiencing a tremendous growth, and there is no real body to oversee its development. Verify that it does not start in every sense, it is necessary that people work together to provide Web development (and HTML!)
    • Tim Berners-Lee, who invented the Web, created in 1994 W3C (short for World Wide Web Consortium). He becomes the director.
      The W3C is an organization whose mission will be to monitrate the evolution of the Web:they had to ensure the web future by not letting some big companies to halt its development for comercial reasons. W3C also has the task to propose to As new versions of HTML, precisely so that the Web can evolves.


    From html to Xhtml

    As I said in my story, from the beginning of the Web Tim Berners-Lee created the first version of HTML.
    For indeed, as a computer program, HTML has gone through several versions:
    HTML 1.0: this is the first version created by Tim Berners-Lee in 1991.
    HTML 2.0: the second version of HTML is in 1994 and will end in 1996 with the appearance of HTML 3.0. This is the version that actually pose the groundwork for future versions of HTML. The rules and operation of this version are given by the W3C (while the first version was created by one man).
    HTML 3.0 was created in 1996, this new version of HTML adds many possibilities of language such as tables, applets, scripts, positioning text around images etc. ...
    HTML 4.0 is the latest versions of HTML (the latest being a slightly modified version, the HTML 4.01). It appears for the first time in 1998, and proposes the use of frames (which cut a web page into several parts), more complex tables, improvements in the forms etc ... More importantly, this version allows for the first When using style sheets, our famous CSS!
    XHTML 1.0: the beginning of 2000, the W3C decides to put an end to what has become merry mess of HTML. Indeed, as and when it evolves, HTML tags were "invented" by Netscape and Internet Explorer (Microsoft). Some tags were walking on a browser, but not the other> <
    We decided to stop the development of HTML and create a new one. XHTML (Extensible HyperText Markup Language) becomes the standard: what language should work the same way on all browsers, and not allowed to create new tags as that W3C has not allowed!
    Specifically, compared to HTML there are very few differences, but the language is more "Strict" you do not have as much right to the error in HTML. That does not mean it is more difficult to use, it's just a habit.

    so for the xhtml XHTML: people came together and agreed to tell how a web page should work. In the end, everyone wins: you (the webmaster) and they (visitors).
    Create a standard, it allows therefore to ensure that everyone understands and speaks the same language. It is always inventing new standards (and not just in computers) that manages to make a difference together

    And the CSS?


    The story begins in the CSS, it in 1996. Returning to the idea proposed by the gentleman I mentioned at the beginning of this appendix (William Tunnicliffe): separate content from layout. This brings many advantages: the appearance of the website may be more easily update the pages will be faster to load, we can offer many designs ... so easily

    • CSS 1: by 1996, the first version of CSS is used. It lays the foundation of this language for presenting his web page, such as color, margins, fonts etc ...
    • CSS 2: appeared in 1999, this new version of CSS adds many options very interesting. You can now use absolute positioning, the pseudo-format: before and: after etc etc ...


    of course there other version of css(but this is as much as i fallowed x) ).

    now here comes the real deal


    Remember, the W3C has established standards. It is necessary to respect them, so we can be sure that all websites speak the same "language".

    The W3C provides on its website ([url]www.w3.org[/url]) a tool called "validator" ("Validator" in English ).
    The validator is a kind of program that will analyze your source code and tell you if it is done correctly, or if there are errors you must correct.

    There are two different validators:

    • A (x)HTML validator.
    • A CSS Validator CSS.


    We will learn to use the two starting with the XHTML validator.
    For information, the XHTML validator could show you several errors on your web page. Do not worry, it's normal the first time
    However, the CSS validator does not ask us few problems, it is rare to make mistakes in CSS in XHTML.

    Xhtml validator

    First, start by putting this page to your favorites is the address of XHTML validator: [url]http://validator.w3.org/[/url].
    Those who have downloaded the plugin "Web Developer" Firefox can also perform validation automatically via a special menu.

    The page you have before you is very simple. It offers two ways to validate:
    Either you validate an XHTML page that is already on the web. In this case, simply enter the URL of the page (eg "http://www.monsite.com/page.html").
    Either you do not sent your pages on the Web (so they are still on your hard drive). You can directly send the page to the validator from your disc to the analysis.


    In two cases, the result will be similar, there is no difference.

    If all goes well (you're very lucky) you will see the following message:

    This Page Is a valid Xhtml 1.0 Strict!

    Firstly, a good thing to put you in the head: this is not because your website appears correctly it does not contain errors.
    Your web page can be all beautiful and have a lot of mistakes.

    Be aware that browsers "try" to not display errors when they meet to avoid disturbing the user, but nothing tells you that other browsers will not behave strangely!

    Have a valid web page, so it be able to rest easy knowing that we did well to get it right.
    Moreover, and this is verified, a web page built correctly will be more likely to be best positioned in the search results of Google, which will bring you ... more visitors!

    all you gotta do is fallow the tutoriel step by step don't jump and i can assure u'll get your valid pages ^^

    Css validator
    Here I can assure you, it will be faster

    First, here is the URL of the CSS validator to be favorites:

    [url]http://jigsaw.w3.org/css-validator/[/url]

    You must indicate the address where the CSS file that you want to validate. You can also, as for XHTML pages, send directly from your hard drive you CSS.
    Note that, as XHTML files, if you have multiple CSS files you gonna have to validate all of them ^^ .

    wp that's it the xhtml that was it ^^ hope u guys enjoyed it and see you soon with php/mysql , remember if you still can't get something or wanna add a notice feel free to add an answer here allright thx you all for reading and have a nice day

  14. #44
    Registered User Stormhunter's Avatar
    Join Date
    Aug 2009
    Location
    Hercegovina
    Age
    36
    Posts
    174
    Nice lesson thnx for sharing
    i enjoy reading this

    Alot of these stuff we didnt cover in our collage like "<optgroup> </optgroup>"
    due time constrains of class
    These tiny details sometimes really save your day


  15. #45
    Registered User XpHakunaMatata's Avatar
    Join Date
    Oct 2006
    Location
    In the air
    Posts
    92
    Great tutorial
    I was already learning a bit 'bout xhtml and css throw other tutorials, but this thing that you guys did is great!
    A Pametne Kritike Klovnovi Daju
    Samo Da Leče Svoje Bolesne Glave
    Težak Je Rad Kad Želiš Sve Ono
    Duhovno Vredno Bez Novca I Slave

Page 3 of 4 FirstFirst 1 2 3 4 LastLast

Posting Permissions

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

Affiliates