Because if we membua layout is wrong , then the web we will also be translated incorrectly by the browser . It also can be caused by any browser memilliki language support ( CSS ) , and of course different from the default browser itself different . Most browsers are finicky about css layout IE due to the lack of support for CSS .
If we have a lot of HTML files , we only need one CSS file , so that when we change the type of font in the CSS file then all the associated HTML file on the CSS file will be changed . CSS is standardized by the W3C ( World Wide Web Consortium ) . CSS can be mounted on dikumen HTML has finished .In a web melayout there are two methods that are often used to create a web page layout , namely :
1 . methods Table2 . methods DivBenefits of CSS :
=> HTML code to be simpler and easier to handle ,
=> File size becomes smaller , so the files load faster,
=> Easy to change the look , just by changing the CSS file only,
=> Can collaborate with JavaScript .
=> Used in almost any web browser .
In general, there are four sections that often exist in a web layout that is :Header - > contains a web theme / title
Menu - > menu web links
Content - > content from the web
Footer - > identity / copyrightattribute ID
There are two ways the placement of elements in the web with CSS , namely :
1 . Position ( Position )
Using the position property there are 4 ways :
Static - > the normal (default ) .
Relative - > position of an element depends on the other elements .
Absolute - > position of the element based on the browser window .
Fixed - > elements remain though shifted position .
2 . Float ( stuck )
Using a float or clear properties :
Float: left - > element will be attached to the left of the parent element .
Float: right - > element will be attached to the right of the parent element .
Clear : left - > element will be attached to the left and below .
Clear : right - > element will be attached to the right side and under
Clear: both - > element will be in a position above the bottom element .Picture below is the basics of setting / format with css position :
Margin -> distance / boundary element with another element
Border -> border / edge element gari
Padding-> spacing element with element content (child elements)
Here the picture below is a standard format to make an appearance with CSS:
writing sample css:
Border -> border / edge element gari
Padding-> spacing element with element content (child elements)
Here the picture below is a standard format to make an appearance with CSS:
writing sample css:
<html>
<head>
<style type = "text/css">
#header {
width:900px;
height:50px;
border: 1px solid #640404;
}
#headerLeft {
width:400px;
background-color:#CCCCCC;
height:50px;
float:left;
text-align:center;
}
#headerRight {
width:450px;
background-color:#999999;
height:50px;
float:right;
text-align:center;
}
</style>
</head>
<body>
<h1>Sample</h1>
<div id = "header">
<div id="headerLeft">Header Left</div>
<div id="headerRight">Header Right</div>
</div>
</body>
</html>
There are 3 ways to install the CSS in HTML documents , namely :
=> External Style Sheet ( CSS different files from HTML files ) ,
=> Internal Style Sheet ( CSS code installed in the HTML head tag )
=> Inline Style Sheet(CSS code directly mounted on HTML tags,not recommended)
I suggest you use the External Style Sheet because it is easier to manage
.Here I will explain the basics of CSS . Immediately, we try the following code :
Placement of CSS in HTML
internal CSS
The method of writing the CSS code directly in the HTML file .
example :
<html>
<head>
<style type = "text/css">
. header {
width: 900px ;
height: 50px ;
border: 1px solid # 640404 ;}
. headerLeft {
width: 400px ;
background-color : # CCCCCC ;
height: 50px ;
float: left ;
text-align : center ;
}
. headerright {
width: 450px ;
background-color : # 999999 ;
height: 50px ;
float: right ;
text-align : center ;
}
< / style>
< / head>
<body>
external CSS
separate CSS file with HTML . Create a file with ekstention . Css .
example :
<html>
<head>
<link rel="stylesheet" type="text/css" href="public.css"/>
< / head>
<body>
< / body>
< / html >
inline CSS
Writing CSS code in HTML tags .
example :
<html>
<head>< / head>
<body>
<div style="background-color:#999999; text-align:center;"> Inline CSS
< / div >
< / body>
< / html >
1 comments:
sangat bermanfaat utk para pemula seperti saya.. thx..
ReplyPost a Comment