Quantcast
Viewing all articles
Browse latest Browse all 15

5 Customization of Simple Blogger Template | Mission 5

Lesson 5: Five simple customization of the simple Blogger template we created in the previous tutorial.

Previously, we saw how to create the simple Blogger skeletal template. We also saw all the Blogger specific codes involved in the template. Now, we shall redesign the template to the next extent necessary for understanding before going much advanced.

This is how the template looked before in Lesson 4/Mission 4:
DEMO

This is how the template would look after this tutorial:
ALTER EFFECT DEMO

PREVIOUS MISSIONMission 4: Create A Simple Blogger Template
NEXT MISSIONMission 6: Understanding Blogger Specific Tags

Mission 5 Objectives:

1) Remove the top nav-bar from Blogger.
2) Adjusting the height of the header space. [ Also other styling possible]
3) Adjusting the sidebar width. [ Also other styling possible for sidebar ]
4) Adjusting the main content area width. [ Also other styling possible for Main Content Area ]
5) Making the sidebar stay to either left or right. Our choice right?

I guess 5 sub-lessons are enough to start with for lesson 5 Image may be NSFW.
Clik here to view.
🙂

1. Remove the Top NavBar from Blogger.

The first objective is covered in the link we have provided. You can easily remove by adding a small CSS snippet along with other CSS.

2. Adjusting the height of the header space:

Search for this code from your template:

/* -----   HEADER STYLING  ----- */

#header-wrapper {
/* Header Wrapping */
height:100%;
position: relative;
padding: 0px;
min-width: 800px;
max-width: 1000px;
text-align:center;
margin-bottom:5px;
}

#header {
/* Main header settings */
height:200px;
width:900px;
border:1px solid green;
background: #fff;
padding:0px;
margin: 0px auto; /* CENTERING HEADER */
}

Here we have given the height as 200px. This value can be changed or even removed to maintain a natural height as you add elements into the header.
We shall adjust the height to 100px.
#header{height:100px;}
>> Header-wrapper is the outer covering of the actual header which has the elements like header image or header text of your blog.
>> We use a min-width and max-width of 800px and 1000px respectively so that the header wrapper can adjust according to different resolutions.
Note: You can remove the min-width and max-width to give a static width to your sidebar.
Changing Header background color to Red and Yellow
>> Background color of your header by default is white.
>> Set the header-wrapper to Red background.
>> Set the header to yellow background.
Code:
#header-wrapper{background:red;}
#header{background:yellow;}

Adjusting Padding of Header:
Padding is used to get a square space on all side inside a box shaped element.
Margin is used to get a square space on all sides outside a box shaped element.
Both of the padding and margin uses the CSS box-model.Padding/Margin can be increased for the header-wrapper.
Padding/Margin can be increased for the header space.
Padding/Margin can be increased for every gadget/widget element in header.
Padding/Margin can be increased for any other element on the header.

Given a padding of 10px inside the header as:

#header{padding:10px;}

Learn more about padding and margin.

Adding Border Around the Header:
You can use the CSS property border to add borders for every element. Borders can be added even for a link in the header.
I’ve set a dashed blue border for the header using the following code:

#header{border: 1px dashed blue;}

1px is the width of the border.

Learn more about borders from here.

Misc. Header settings:
Font Styles can also be changed in the header like font color, font family and other font properties.
Added a italic font-style and times font family as shown below:

#header{ font-family:"Times New Roman", Times, serif; font-style:italic; }
Full customized code after some changes:#header-wrapper {
/* Header Wrapping */
height:100%;
position: relative;
padding: 0px;
min-width: 800px;
max-width: 1000px;
text-align:center;
margin-bottom:5px;
background:red;
}
#header {
/* Main header settings */
height:100px;
width:900px;
border:1px dashed blue;
background: yellow;
font-family:"Times New Roman", Times, serif;
font-style:italic;
padding:10px;
margin: 0px auto; /* CENTERING HEADER */
}

3. Adjusting the sidebar width.

Similar to header, we can customize and add new styling for sidebar as well.
Here is the complete code you need to search for:

.sidebar-wrapper {
width:300px;
display: inline; /* handles IE margin bug */
float: right;min-width:200px;max-width:400px;
margin:0px;
padding:10px;
margin-left:30px;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
}
.sidebar {
margin:0px;padding:10px;
width:260px;min-width:100px;max-width:260px;
text-align: left;
}

The .sidebar-wrapper is the outer covering/wrapper for the actual sidebar space/area where widgets and other sidebar elements can appear.
You need to proportionally change the .sidebar-wrapper and .sidebar element width.

Note: The min-width and max-width are not supported in older browsers.

Adjusting Background Color of Sidebar:
By default the background colors of the .sidebar-wrapper and #sidebar is “WHITE”.
To change the background color of sidebar-wrapper and sidebar.

You need to add the following code into the CSS as shown below:
We set the sidebar-wrapper to green and sidebar1 to yellow.

.sidebar-wrapper{background:green;}

#sidebar1 {background:yellow; }

Note: #sidebar1 is the first sidebar id.
Important: It is preferred to use same color background for sidebar-wrapper and all individual sidebar.

Adjusting Padding of Sidebar:
Padding is used to get a square space on all side inside a box shaped element.
Margin is used to get a square space on all sides outside a box shaped element.
Both of the padding and margin uses the CSS box-model.

Padding/Margin can be increased for the sidebar-wrapper.
Padding/Margin can be increased for the individual sidebar.
Padding/Margin can be increased for every gadget/widget element in sidebar.
Padding/Margin can be increased for any other element on the sidebar.

Learn more about padding and margin.

Adding Border Around the Sidebars:
You can use the CSS property border to add borders for every element. Borders can be added even for a link in the sidebar or for your headings in the sidebar.
Learn more about borders from here.

Misc. Sidebar settings:
Font Styles can also be changed in the sidebar like font color, font family and other font properties.

4. Adjusting the main content area width:

Before knowing the main content area, we need to know the content-wrapper where Sidebar and Blog content reside.
Here is the code for content-wrapper:

#content-wrapper {
/* Main Content Resides here(Blog content & sidebar )*/
position: relative;
padding:0px;
border:1px solid brown;
min-width: 800px;
max-width: 1000px;
width:900px;
margin:0px auto; /* CENTERING CONTENT WRAPPER */
background:#aaa;
}

The above content wrapper has the background color of #aaa
Find the following code for #main-wrapper similar to sidebar-wrapper and #main similar to #sidebar1

#main-wrapper { /* Main wrapping */ float: right; margin: 0px; padding:10px; border:1px solid red; display: inline; /* handles IE margin bug */ width:530px;min-width:300px; max-width:700px; word-wrap: break-word; /* fix for long text breaking sidebar float in IE */ overflow: hidden; /* fix for long non-text content breaking IE sidebar float */ }
#main { /* Actual Main blog post area settings */ margin: 0px; padding: 0px; width:530px;background: white; border:1px solid #aaa; }

I’ve kept both the width of #main-wrapper and #main same at 530px.
Change the width to anything you wish you notice the change.
Rest of the other settings can be followed similar to how we did for sidebar/header.

5. Making the sidebar stay to either left or right:

This is very simple.
Find the following sidebar code:

.sidebar-wrapper {
width:300px;
display: inline; /* handles IE margin bug */
float: right;
margin:0px;
padding:10px;
margin-left:30px;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
background:green; /* ADDED IN THIS TEMPLATE */
}

Change the float option as shown:
.sidebar-wrapper {
width:300px;
display: inline; /* handles IE margin bug */
float: left; /* ADDED IN THIS TEMPLATE */
margin:0px;
padding:10px;
margin-left:30px;
word-wrap: break-word; /* fix for long text breaking sidebar float in IE */
overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
background:green; /* ADDED IN THIS TEMPLATE */
}

Just by changing right or left for float property of sidebar-wrapper we can re-position the sidebar to either left or right.

Hope you liked this tutorial. Catch you again with some of them from the Template tutorial series.

—-To be Continued —-

The post 5 Customization of Simple Blogger Template | Mission 5 appeared first on iTechColumn.


Viewing all articles
Browse latest Browse all 15

Trending Articles