Tuesday 18 November 2014

Cascading Style Sheets: The Box Model (Unit 20+28, Assignment 2 - Task 4)

Margin:
The margin is a clear space between the edge of the inside of the browser, sort of like how a word document has a margin between the content and the edge of the paper.


Border:The border is a line that surrounds the padding and content, this is under the margin, the actual webpage begins after this point.

Padding:
This is a clear area that surrounds the content, it's transparent.


Content:
This is where the text, images and interactive content will be displayed.


Reference:
W3 Schools,
http://www.w3schools.com/css/css_boxmodel.asp, 18/11/2014

Tuesday 4 November 2014

CSS Implementation Styles: Advantages and Disadvantages (Task 3)


Introduction:


In this document I will be explaining the different Cascading Style Sheets (CSS) Implementation Styles, these are; Inline, embedded and external. I will also describe the advantages and disadvantages of each implementation style and how they can be used in certain types of websites and what scenario each style may be used in.

Inline:


Inline implementation is applied within the Hyper Text Mark-up Language (HTML) code, so if you were to type out a HTML tag, you would apply the CSS after you write out the tag. For example; <body> would become <body style = “color: purple”> if I wanted all the text within the body tags to be purple. It’s probably one of the simplest ways of writing up CSS, but it can get complicated. Inline implementation is more useful for testing certain circumstances, for example if I wanted to test what a page would look like with a black and yellow background, I would first test it in the HTML file, to see if it looks alright. It also takes up less memory than external implementation; it’s the most light-weight type of CSS implementation.

It could be used for a single webpage, for instance some websites only require one single webpage to establish a point or an idea, and inline implementation would be useful in this sense. The advantages of inline implementation is the fact that it’s easy and straightforward to do, as you can keep coding in the same HTML file that you opened, so it’s quite quick to use in certain situations. It can also be used to make fine details to a certain piece of text, but it’s still not recommended to do so. Again for testing purposes this is great, and outdoes most implementation styles, as you can see how a small bit of text looks in the theme you are trying to create and then decide whether it’s a good idea to implement it across the whole website.

However the main disadvantage of inline implementation is that if you were to create a big website with multiple webpages, it would get extremely complicated and cluttered. This means that it’s perfect to be used in quick projects where the main objective is to test. It’s completely unorganised and you have to keep retyping it for every new tag you create which can end up becoming tiring. It is extremely inefficient if you’re even doing a big webpage, let alone a set of webpages, as you would need to remember what you typed beforehand as well.

Advantages:


-          Quick to deploy, probably one of the quickest ways to implement your CSS.

-          Small and concise, uses the least amount of memory.

-          Good for a programmer to test code, since it’s specific, it also means you can test a range of formatting to find the one that best suits your website.


Disadvantages:


-          Complicated if creating multiple webpages, has to be retyped every time.

-          Extremely complicated if a whole theme needs to be changed, since everything has to be retyped.

-          Messy and hard to read, doesn’t look appealing when another individual takes a look at the code.

-          Can’t specify a set of tags, has to be retyped for every new tag created.


Embedded:


Embedded implementation is applied within the <head> tags within the HTML code, similar to inline implementation. However embedded will have its own <style> tag to deal with, and will then provide a list of HTML tags and properties, the properties will be implemented into the tags that are listed. It appears in a list sort of format and can be helpful for a big webpage, but the complexity will begin to show when you start adding multiple webpages. So again the main disadvantage to the embedded implementation will be that it wouldn’t be suitable with a website with 3 or more webpages involved, since you’d have to write out the style code each time you create a new webpage. This type of implementation also takes up less memory than external, and is more light-weight as it it’s already inside of the HTML file.

However the main advantage is that it can be used to change a whole webpage that can be separated from the main website, this also means that if you have a complicated webpage you want to test and it would become cluttered if you used inline, you can just use embedded to quickly test the whole thing. You can also copy this code over to other webpages to test the same thing, since it’s a simple single tag within the <head> tag. It can also be used for relatively small websites that only have a few webpages, since it is easy to use and you can just copy over the code that you placed within the HTML file of the first webpage that you designed. Anything over a few webpages, like a massive HTML website project would require a special implementation style known as external.

Advantages:


-          Easy to code, takes up one section and all the code is placed there in a list sort of format.

-          Useful for one-page websites as it applies to a single page.

-          Relatively easy to make changes.

-          Looks neater than inline as it has its own section.

Disadvantages:


-          Hard for multiple page websites as you’d have to retype your section of code for each page.

-          Can’t specify as much as inline, so you couldn’t test multiple ranges of formatting to find the one that bests suits a webpage.

 

External:


External implementation is widely used and is the cleanest way of designing a whole website, the reason for the name is that the CSS code will appear in a file that is separated from the HTML file. This allows for more flexibility and more focus for each set of code, since you don’t have to get into the way of the CSS code when you start coding in HTML. However the two files a linked via a simple one line tag known as “<link>”, this tag contains three variables; “rel” which specifies the association between the current file and the linked external file. Then there’s “type” which describes the type of media of the linked file, which in this case is “text/css”, after that you’ll have “href” which is the direct URL which will specify the location of the linked file.

The full tag would look like this:
<link rel="stylesheet" type="text/css" href="theme.css">
this tag would be held within the <head> tag and would link directly to a text file known as “theme.css” which would then contain all the CSS code to be used by the webpage or set of webpages.

This form of implementation would allow a great advantage when developing a large website with a lot of webpages, since you can just set up the webpages to link to one single CSS file. This also means it makes you keep a general theme with your website, which enables it to look clean and user-friendly. Another advantage would be the fact that you can change any part of the CSS file and it would affect all of the webpages linked to it instantly. This makes modifying a website easy and quick, this also allows you to change it according to an event like Christmas and Halloween. It’s also a lot more organised and easier to manage than either embedded or inline since with those types of CSS implementation you have to keep referring to the HTML document. But with external implementation you just have to refer to the file that contains to the CSS and when you have to edit the HTML; you refer to the HTML files. You can also create multiple style sheets to use as several themes for when you explore the whole website.

There are some disadvantages that come with external however; it takes more time to create an external file than to code in CSS within the original HTML file. This means that if you wanted to do some quick testing you would not use external implementation at all, it would be much better to use either inline or embedded depending on the situation. It also technically takes up more memory than a single HTML file, since you are using two files both of which could take up considerable amounts of memory, especially if you were buying a domain name that had a specific limited amount of bandwidth. In this aspect if you have a small budget and bandwidth and only wanted to create a simple website with a few webpages you could use embedded CSS.

Advantages:


-          Makes things a lot tidier as the CSS is separated from the HTML.

-          Allows one to change a whole set of webpages by changing one CSS sheet.

-          Allows one to specify individual webpages or sets of webpages by creating multiple CSS sheets.

-          A lot easier than all other implementation styles to make big changes to a whole website.

Disadvantages:


-          Can’t specify individual tags as well as inline can’t make small changes to different tags as the CSS within an external sheet applies to all of the tags you set that CSS to.

-          Uses up more memory, storage space and bandwidth.

-          Not useful on a single-page website as it would be a waste of space and time.

-          More time consuming to code in CSS, not good for testing.

References:



 

HTML and CSS (Assignment 2 Task 2)

Introduction:

In this document I will be describing how the HTML and CSS languages work together to produce webpages. I will describe both of their purposes in the development of websites and also compare them and explain how they work together in the development of websites.

HTML:


HTML stands for Hyper-Text Mark-up Language, just by the name alone you can tell that HTML was meant to be used to display and manipulate text. HTML is the skeleton of a webpage in the sense that you’ll need the basics of HTML code to apply any form of CSS formatting. HTML is used to layout content. It deploys tags and properties to lay out the foundation of a webpage. If you were to look at a human and look at the skeleton bone structure you could think of the skeleton as the HTML code, like how we need our skeleton for us to stand, HTML is needed for a webpage to work.

 

It’s also used for creating ordered and unordered lists; an unordered list is a bullet-point based list while the ordered list is an ordered numbered list. Additionally you can use HTML to make headings of varying sizes. It can even create tables that can be filled with tabular information. HTML is not used for any kind of formatting this is where Cascading Style Sheets (CSS) come into play.

CSS:


CSS is used to format and customize the look of the webpage, it can do things like change the colour, font size, font type and the back ground colour of a web page. In a sense it’s the second layer of a webpage, and is usually the one that will set up the design of webpage. CSS can edit the layout of a webpage and controls the aspects of it as well, for example the “margin” property can be used to set up the margins of a webpage, you can then edit each value of a webpage. As an example here is a HTML page without any CSS applied:


 

 















With CSS:








 










As you can see CSS makes a big difference in terms of laying out and formatting a webpage, as it enables you to describe the different aspects of the page and what happens to it. Several things are applied here, the followings properties were used:
“color”, “background-color”, “margin”, “border”, “font-size” and “font-family”.

However CSS is not meant to be used in laying out content or text, it is meant to only format the text that is already implemented by HTML, which brings me to the next point.

Comparison and Contrast:


When comparing HTML and CSS you must keep in mind they were meant to be used together and they aren’t better than one another. HTML allows a foundation to be created that is used for the basis of the webpage, CSS then formats it, and makes it appealing to the eye. If we were thinking of someone building a house, they would first build the framework of the building (HTML), and then apply a design to it (CSS).

 

CSS can be applied to multiple tags in HTML; a style sheet looks something like this:

 



 

You first type in the tag the CSS will be applied to and then a list of CSS tags. For example “body” is a HTML tag, and everything surrounded in curly brackets are the properties that will be applied when the HTML tag “body” is used inside of a webpage. The example above this one showed what one page looked like without CSS, this is the same code that was used to design that page.

CSS can also be used to be applied to different parts of a webpage, in the above example it was applied to the tag “body” which means the following CSS will apply to all of the webpage’s text. However you can also apply CSS to specific HTML tags like “p” which is the tag used to create a paragraph, or even apply CSS to a table, to give it a unique look. CSS can also be used for the layout of a webpage, so things like creating margins and columns is possible here. Once you’re done setting up a CSS style sheet like the one above, once you create a webpage that is linked to the sheet via HTML it will have all the properties you have listed.

 

 

References:


W3Schools, 27/10/14, http://www.w3schools.com/css/




Wikipedia, 27/10/14, http://en.wikipedia.org/wiki/HTML

W3Schools, 27/10/14, http://www.w3schools.com/html/


HTML GOODIES The ultimate html resource, 27/10/14, http://www.htmlgoodies.com/