Skip to main content

How to set a web page to the center of the browser

āļ…āļ¯ āļ…āļ´ි āļšāļ­ා āļšāļģāļą්āļą āļŊැ⎃්āļ­ි ⎀ෙāļą්āļąේ āļ…āļ´ිāļ§ web page āļ‘āļšāļš් design āļšāļģāļąāļšොāļ§ āļ•āļąේ ⎀ෙāļą āļ´ොāļŠි technique āļ‘āļšāļš් āļœැāļą. āļ”āļēාāļŊ āļ•āļąේ āļ­āļģāļ¸් āļ¯ැāļšāļŊ āļ‡āļ­ි web sites ⎀āļŊ āļ¸ු⎅ු page āļ‘āļšāļ¸ center ⎀ෙāļŊා āļ­ිāļēෙāļąāˇ€ා. āļ…āļ´ි āļ‹āļ¯ා⎄āļģāļĢāļēāļš්‌ āļœāļ­්āļ­ොāļ­් W3Schools site āļ‘āļš āˇ€āļœේ. āļ´ේāļąāˇ€ා āļąේ site āļ‘āļšේ content āļ‘āļš page āļ‘āļšේ āļ¸ැāļ¯āļ§ āˇ€ෙāļą්āļą āļ­ිāļēෙāļą āļŊ⎃්⎃āļą.

āļ¸ේāļš āļšāļģāļœāļą්āļą āļ´ු⎅ු⎀āļą් āļ¸ෙāļą්āļą āļ¸ේ ⎀ිāļ¯ි⎄āļ§.

 <html>  
   <head>  
     <title>Testing Centered Content</title>  
   </head>  
   <body>  
     <div id="mainContent" style="width:900px;margin-left:auto; margin-right:auto;background-color:Gray;height:500px">  
       This is the content which is centered  
     </div>  
   </body>  
 </html>  

āļ¸ෙāļ­āļą āļ…āļ´ි āļ‡āļ­්āļ­āļ§āļ¸ āˇ€ි⎁ේ⎂ āļ¯ේ⎀āļŊ් āļ´ා⎀ිāļ ්āļ ි āļšāļģāļŊා āļąෑ. ⎃āļģāļŊ html code āļ‘āļšāļš් āļ­āļ¸ා āļ­ිāļēෙāļą්āļąේ.

āļ…āļ´ි <div> āļ‘āļšāļš් ⎄āļ¯ාāļœෙāļą āļ­ිāļēෙāļąāˇ€ා mainContent āļšිāļēāļŊ. āļ’ div āļ’āļšāļ§ style āļ‘āļšāļš් apply āļšāļģāļŊ āļ­ිāļēෙāļąāˇ€ා.
āļ‘āļšේ āļ…āļ´ි āļšāļģāļŊා āļ­ිāļēෙāļą්āļąේ site āļ‘āļšේ content width āļ‘āļš āˇƒෙāļ§් āļšāļģāļŊා āļ­ිāļēෙāļąāˇ€ා pixel 900 āļšāļ§.
āļŠāļ§ āļ´āˇƒ්⎃ේ ⎀ැāļ¯āļœāļ­් ⎀ෙāļą්āļąේ margin-left āļ‘āļšāļēි margin-right āļ‘āļšāļēි ⎃ෙāļ§් āļšāļģāļŊා āļ­ිāļēෙāļą āˇ€ිāļ¯ි⎄. āļ…āļ´ි āļ‘⎀්⎀ා ⎃ෙāļ§් āļšāļģāļŊා āļ­ිāļēෙāļąāˇ€ා auto āļšිāļēāļŊා. āļ‘āļšෙāļą් āļ­āļ¸ා āļ…āļ´ිāļ§ āļ•āļąේ āļ¸ේ center āļšāļģāļą āˇ€ැāļŠේ āļšෙāļģෙāļą්āļąේ.

āļŠāļ§ āļ´āˇƒ්⎃ේ āļ¸ේ background-color āļ‘āļšāļēි height āļ‘āļšāļēි ⎃ෙāļ§් āļšāļģāļŊා āļ­ිāļēෙāļą්āļąේ āļ¸ේāļš browser āļ‘āļšේ āļļāļŊāļ¯්āļ¯ී āļ”āļēාāļŊāļ§ āļ´ැ⎄ැāļ¯ිāļŊි⎀ āļ´ේāļą්āļą āļ•āļąේ āļąි⎃ා.

āļ‰āļ­ිāļą් āļ¸ේāļš āļ¸ෙ⎄ෙāļ¸ āˇ„āļ¯ාāļœāļ­්āļ­āļ§ āļ´āˇƒ්⎃ේ āļ”āļēාāļŊāļ§ āļ•āļąෙāļ¸ content āļ‘āļšāļš් (div, p, table ⎀āļœේ) āļ¸ේ āļ…āļ´ේ āļŊොāļšු div āļ‘āļš āļ‡āļ­ුāļŊāļ§ āļ¯ාāļœāļą්āļą āļ´ු⎅ු⎀āļą්.

āļ­āˇ€āļ­් āļ¸ේāļš āˇ€ැāļŠි āļ¯ිāļēුāļĢු āļšāļģāļą්āļą āļ•āļąේ āļąāļ¸් āļ´ු⎅ු⎀āļą් āļ¸ේ style āļ‘āļš css āļ‘āļšāļšāļ§ āļ¯ාāļŊ āļ’āļš āļ”āļēාāļŊāļœේ pages ⎀āļŊ āļ´ා⎀ිāļ ්āļ ි āļšāļģāļą්āļąāļ­්.

āļ…āļ´ි css āļœැāļą āļ´āˇƒ්⎃ේ āļ¯āˇ€āˇƒāļš āļšāļ­ා āļšāļģāļ¸ු. āļ‘⎄ෙāļąāļ¸් āļ…āļ¯āļ§ āļ”āļē āļ§ිāļš āļ­āļ¸ා.

2011/12/05
āļ¸ේ āļŊිāļēුāļ¸āļ§ āļ­āˇ€ āļ´ොāļŠි āļ¯ෙāļēāļš් āļ‘āļšāļ­ු āļšāļģāļą්āļą āļšිāļēāļŊ āļ…āļ´ේ ⎂āļ¸්āļ¸ි āļ¸āļ§ āļšි⎀්⎀ා. āļ´āˇ„āļŊ āļ­ිāļēෙāļą්āļąේ āļ¸ේāļš āļšāļģāļœāļą්āļą āˇ‚āļ¸්āļ¸ි āļšිāļēāļą āˇ€ිāļ¯ි⎄.

"HTML āļšෝāļŠ් ⎀āļŊ ⎃්āļ§āļēිāļŊ් āļ¯ාāļą āļ‘āļš āˇƒāļ¸āˇ„āļģ ⎀ෙāļŊා⎀āļ§ āļšāļģāļ¯āļģāļēāļš් ⎀ෙāļąāˇ€ා. ⎀ි⎁ේ⎂āļēෙāļą් āļ¸ āļŊොāļšු ⎀ෙāļļ් ⎃āļēිāļ§් āļ‘āļšāļš. āļ¸āļ¸ āļ´āļŊ්āļŊෙ⎄ාāļēිāļą් āļ¯ාāļŊ āļ­ිāļēෙāļą්āļąේ CSS āļ‘āļš."

 <html>   
   <head>   
    <title>Testing Centered Content</title>   
       <style>  
           #mainContent  
           {  
                width: 900px;  
                margin: 0 auto;  
                background-color: Green;  
           }  
       </style>  
   </head>   
   <body>   
    <div id="mainContent">  
     This is the content which is centered   
    </div>   
   </body>  
 <html>  

āļ•āļąේ āļąāļ¸් āļ¸ේ ⎀ිāļ¯ි⎄āļ§āļ­් āļļāļŊāļą්āļą āļ¸ේāļšāļ­් ⎀ැāļŠ āļœිāļą්āļ¯āļģ ⎀āļœේ. āļ‘⎄ෙāļąāļ¸් ⎂āļ¸්āļ¸ිāļ§ āļœොāļŠāļš් ⎃්āļ­ුāļ­ි āļ¸ේ ⎀ිāļ¯ි⎄ āļ´ෙāļą්āļąāļŊා āļ¯ුāļą්āļąāļ§.

Comments

Post a Comment

Popular posts from this blog

Applying Themes for Silverlight 4

āļ§ිāļš āļ¯āˇ€āˇƒāļšāļ§ āļ´āˇƒ්⎃ේ āļŊිāļēāļą්āļą āˇ„ොāļŗ āļ¯ෙāļēāļš් āļ‘āļš්āļš āˇ€ෙāļŊා⎀āļš් ⎄āļ¸්āļļ āļ‹āļąා. āļ¸ේ āļ¯āˇ€āˇƒ් ⎀āļŊ āļ¸āļ¸ āļ´ොāļŠි āļ…āļ­්⎄āļ¯ා āļļැāļŊීāļ¸āļš් āļšāļģāļąāˇ€ා Silverlight 4 āļ‘āļš්āļš. Visual Studio 2010 āļ­āļ¸ා āļ´ා⎀ිāļ ්āļ ි āļšāļģāļą්āļąේ. ⎄ැāļļැāļēි āļ‘āļš āˇ„ිāļ­āļ´ු āļ­āļģāļ¸් āļŊේ⎃ි āļ‹āļąේ āļąෑ. āļ’ āļąි⎃ා āļ¸āļ¸ āˇ„ිāļ­ු⎀ා āļ’ āļœැāļą āļ´ොāļŠ්āļŠāļš් āļŊිāļēāļą්āļą. āļ¸ුāļŊිāļą්āļ¸ āļšිāļēāļą්āļą āļ­ිāļēෙāļą්āļąේ Silverlight 4 āļ‘āļš්āļš āˇ€ැāļŠ āļšāļģāļą්āļą āļąāļ¸් VS 2010 ⎀ිāļ­āļģāļš් āļ­ිāļļුāļąāļ§ āļ¸āļ¯ි, āļ’āļšāļ§ āļ”āļēාāļŊāļ§ āļ•āļąෙ ⎀ෙāļąāˇ€ා VS2010 Service Pack 1. āļ’āļš download āļšāļģāļœāļą්āļą āļ´ු⎅ු⎀āļą් āļ¸ෙāļą්āļą āļ¸ේ āļŊිāļą්āļš් āļ‘āļšෙāļą්. āļ¸ෙāļ­āļą āļ‡āļ­්āļ­āļ§āļ¸ āļ­ිāļēෙāļą්āļąේ ISO image āļ‘āļšāļš්, āļ’āļš mount āļšāļģāļŊා install āļšāˇ…ා āļąāļ¸් ⎀ැāļŠේ āļœොāļŠ. āļŠāļ§ āļ´āˇƒ්⎃ේ āļ…āļ´ි āļļāļŊāļ¸ු āļšො⎄ෙāļą්āļ¯ āļ¸ේ Themes ⎄ොāļēාāļœāļą්āļą āļ´ු⎅ු⎀āļą් āļšිāļēāļŊ. āļ’āļšāļ§ āļēāļą්āļą āļ¸ෙāļą්āļą āļ¸ේ āļŊිāļą්āļš් āļ’āļšāļ§, āļ‘āļ­āļą āļ­ිāļēෙāļą " SL4Themes-templates.zip " āļšිāļēāļą file āļ‘āļš download āļšāļģāļœāļą්āļą. āļ¸ේ themes Microsoft āļ‘āļšෙāļą් officially release āļšāļģāļŊා āļ­ිāļēෙāļą themes ⎀āļœāļēāļš්. āļ‡āļ­්āļ­āļ§āļ¸ āļ¸ේ download āļ‘āļšේ āļ­ිāļēෙāļą්āļąේ Project Templates. āļ¯ැāļą් āļšāļģāļą්āļą āļ­ිāļēෙāļą්āļąේ āļ¸ේāļš Unzip āļšāļģāļŊා VisualStudio2010 āļšිāļēāļą folder āļ‘āļš āļ‡āļ­ුāļŊේ āļ­ිāļēෙāļą JetPack.vsix ⎀āļœේ file āļ‘āļšāļš් double click āļšāļģāļą āļ‘āļš. āļ‘āļšෙāļą් āļ´ොāļŠි Installer āļ‘āļšāļš් āļ¯ු⎀āļŊා install ⎀ෙāļąāˇ€ා Visual Studion Project Template āļ‘āļšāļš්. āļ¯ැāļą් āļš...

Adding Unique Constraints with Entity Framework Code First

Entity Framework Code First is a great way to define and maintain your database within your application it self. While it poses a nice set of complementing libraries like Data Annotations and Fluent Configurations which helps you specially in defining phase of your database, it would give you a headache if you try to define a unique constraint on a column. For example in the users table of your application you could probably have an int ID column which would serve as the primary key and you might need to make your Username column a unique one. Since you are using EF Code First you will soon find out there is no direct way to accomplish this requirement. Unfortunately fluent configurations doesn't have syntax like HasUnique(u => u.Username); I asked the same question in stackoverflow , but didn't get a convincing answer. Since there is no direct support from EF for this you could take one of following alternatives to achieve it. Approach 1 :  ...

The list of do's and don'ts when preparing your resume

During past couple of years many times I was asked by my colleagues in the HR department "Could you please shortlist these resumes for interviews?" answer was almost always yes. As a result I have gone through a large number of resumes to check whether if these people are suitable for an interview.  While I'm scanning these resumes I found many reasons that I could reject these let alone the technical incompetencies of the candidates. Then suddenly one day I said to myself "why don't you write simple blog post about this?". So here I'm trying to put up a list of reasons that your resume might get rejected and how to minimize it. When you read this you will realize how trivial some mistakes are but they could surely cost your chance of landing your dream job. Typos in the resume Well I hate typos because it shows you how inconsiderate you are, keep in mind your resume is the first contact point with your potential employer so why don't ...