Webpage layout: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
1,508 bytes added ,  14:55, 2 November 2018
m
Text replacement - "http://wiki.sandaysoft.com/" to "https://cumuluswiki.wxforum.net/"
m (→‎Spans: correcting)
m (Text replacement - "http://wiki.sandaysoft.com/" to "https://cumuluswiki.wxforum.net/")
(5 intermediate revisions by one other user not shown)
Line 202: Line 202:


[[file:Divlayout3.png]]
[[file:Divlayout3.png]]
=Aside, Section, Article, Header, Footer - the alternative HTML tags=
=Aside, Section, Article, Header, Main, Footer - the alternative HTML tags=
In HTML5, where you could use Div before, you can now use header, footer, aside, article or section.  These were introduced because they are more meaningful terms.
In HTML5, where you could use Div before, you can now use header, footer, aside, main, article or section.  These were introduced because they are more meaningful terms.


header  - this is used to group elements at the start of an article, aside, or section;
 
footer  - this is used to group elements at the end of an article, aside, or section;
<header>   - this is used to group elements at the start of an article, aside, or section;
aside    - this is used to group elements that are not an essential part of the content and typically appear to one side;
 
article  - this is used to group elements that have a logical connection with each other, but are not essential to be related to the elements outside the article grouping;
<footer>   - this is used to group elements at the end of an article, aside, or section;
section  - Like div this is a way of grouping elements, but it is often used when the grouped elements do have a connection with those outside the section grouping.
 
<aside>   - this is used to group elements that are not an essential part of the content and typically appear to one side;
 
<article> - this is used to group elements that have a logical connection with each other, but are not essential to be related to the elements outside the article grouping, you can have several ''article'' elements and can nest them like ''div'';
 
<section> - this is very like 'div', it is a way of grouping elements, it can appear multiple times and be nested; it is often used when the grouped elements do have a connection with those outside the section grouping.
 
<main>    - this is a special grouping tag, it can only appear once, it should not include any navigation links, header nor footer information; it is used to denote the part of a web-page that really matters, the bit you might choose to read first or have displayed when you first visit the page.


=Spans=
=Spans=
Line 280: Line 287:
Here is the complete source code, with the style sheet written into the HTML.  Normally the Stylesheet would be in it's own file, as per the discussion on the previous article
Here is the complete source code, with the style sheet written into the HTML.  Normally the Stylesheet would be in it's own file, as per the discussion on the previous article


http://wiki.sandaysoft.com/files/divlayout.txt
https://cumuluswiki.wxforum.net/files/divlayout.txt




Line 291: Line 298:


=And finally=
=And finally=
So there we have it, <nowiki><div></nowiki> in a nutshell.  You will learn to love Divs as they give you excellent control, and you will use them everywhere.  My basic shell for a webpage often starts like this...
So there we have it, <nowiki><div>, <section>, <article> etc.</nowiki> in a nutshell.  You will learn to love HTML content grouping elements as they give you excellent control, and you will use them everywhere. Most designs have an overall 'container' to wrap everything upTry to visualise the layout with boxes around it, you should be thinking something like that shown in the figure. A basic shell for a webpage often starts like this...


[[file:Divlayout6.png|200px|left]]
<pre><body>
<pre><body>
<div id=”container”>
<article id=”container”>
<div id=”header”>
        <h1> some text </h1>
</div>
<header>
        <h2> some text </h2>
          <p> some text </p>
</header>
 
<nav id=”menu”>
</nav>
 
<main id=”content”>
          <section>
          <h2> some text </h2>
            other HTML
          <section>
          <section>
          <h2> some text </h2>
            other HTML
          <section>
</main>


<div id=”menu”>
<footer>
</div>
</footer>
</article></pre>


<div id=”content”>
To further develop the design, include
</div>


<div id=”footer”>
<pre><aside> some HTML content </aside></pre>
</div>
</div></pre>


Notice I have an overall 'container' div to wrap everything up.  Try to visualise the layout with boxes around it, you should be thinking something like this:
to add in information not directly related to the


<pre><main> some HTML content </main></pre>.


[[file:Divlayout6.png|200px]]
Your [[Stylesheets]] could position this to the right hand side of the content in 'main' for viewing on a monitor, but below it for narrower media when you print or view on some other devices. Have a look at the HTML used on those web-sites you like, as most browsers offer 'view source'.


= The next article to read …… =


Learn how to use a PHP script to generate HTML web pages. See [[PHP|PHP Hypertext Preprocessor]].


Happy 'Div' ing!
Original article [[User:Daj|Daj]] 18:07, 13 February 2011 (UTC)


[[User:Daj|Daj]] 18:07, 13 February 2011 (UTC)
Updated to HTML5 standard [[User:Sfws|Sfws]] ([[User talk:Sfws|talk]]) 23:41, 22 April 2015 (PDT)


[[Category:WebTips]]
[[Category:WebTips]]

Navigation menu