SlideShare a Scribd company logo
1 of 24
Ramachandran G
#page {
  width: 960px;
  margin: 0 auto;
  }



The above will center the div with an id of page inside it’s parent container.
The HTML:
<div id="container">some text here</div>

The CSS:
div#container {height: 35px; line-height: 35px}



If you want to vertically center text within a containing block who’s height
 is fixed, simply set the line-height of the text to be the same as the height
of the containing block
Method 1
The HTML:
<div id="content">your content here</div>

The CSS:
div#content {position: absolute; top: 50%; height: 500px; margin-top:
  -250px}

The top left corner of the div will be positioned 50% from the top. Since we want
the center of the div to be positioned 50% from the top you need to set a negative
top margin equal to half the height of the div.
This same trick works for horizontal centering as well.
Change top to left and margin-top to margin-left and set the negative margin to
be half of the width of the element.
Method 2

The HTML :
  <div id="wrapper">
        <div id="cell">
                 <div class="content"> Content goes here
                 </div>
         </div>
   </div>

The CSS:
#wrapper {display:table;}
#cell {display:table-cell; vertical-align:middle;}


This method sets some <div>s to display like a table, so we can use the
table’s vertical-align property
div#button{
  background: #888;
   border: 1px solid;
   border-color: #999 #777 #777 #999 ;
  }
The CSS above will create a button with the light source at the upper left.
Usually one or two shades of color change is all that’s needed, but you can
experiment for different effects.
body { font: font-style font-variant font-weight font-size
  line-height font-family; }

Would look like this
body{font: normal bold 14px 18px arial;}


You don’t need to include every property, but know that for any you don’t
include that property will be reset to it’s default.
div#content {width: 580px}
*html body div#content {width: 600px}

IE7 specifically with
*+html body div#content {width: 620px}
.element {
min-height: 500px
height: auto !important
height: 500px
}
For IE6

 .element {
 min-height: 500px
 _height: 500px
 }
Element, Pseudo Element d = 1 – (0,0,0,1)
Class, Pseudo class, Attribute c = 1 – (0,0,1,0)
Id b = 1 – (0,1,0,0)
Inline Style: a = 1 – (1,0,0,0)

p: 1 element – (0,0,0,1)
div: 1 element – (0,0,0,1)
#sidebar: 1 id – (0,1,0,0)
div#sidebar: 1 element, 1 id – (0,1,0,1)
div#sidebar p: 2 elements, 1 id – (0,1,0,2)
div#sidebar p.bio: 2 elements, 1 class, 1 id – (0,1,1,2)
triangle {
border-color: transparent transparent green transparent;
border-style: solid;
border-width: 0px 300px 300px 300px;
height: 0px;
width: 0px;
}
.cirlce {
 width: 300px;
height: 300px;
background-color: red;
border-radius: 150px;
-moz-border-radius: 150px;
-webkit-border-radius: 150px;
}
Preventing:
  h1 { white-space:nowrap; }

Sometimes the text in a link or heading will break where you don’t want it to

Adding:
HTML:
<p><span>hello></span><span>How are you</span></p>

CSS:
p span {
   display: block;
}
h1 {
text-indent:-9999px;
background:url("h1-image.jpg") no-repeat;
width:200px;
height:50px;
}
a {outline: none}
or
a {outline: 0}
@font-face {
   font-family: 'LeagueGothic';
   src: url(LeagueGothic.otf);
 }

 header {
   font-family: 'LeagueGothic';
 }
div {
    text-overflow: ellipsis;
  }
A long cold winter delayed the blossoming …
color: rgba(255, 0, 0, 0.75);
background: rgba(0, 0, 255, 0.75);
.multibg {
    background: url(src/zippy-plus.png) 10px center no-repeat,
                url(src/gray_lines_bg.png) 0 center repeat-x;
  }
textarea{
overflow:auto;
}
The HTML :
    <a href="#" class="tooltip">Tooltip<span> Extra info </span></a>


The CSS :

a:hover {
background:#ffffff;     /*BG color is a must for IE6*
text-decoration:none;
}
a.tooltip span {
display:none;
padding:2px 3px;
margin-left:8px;
width:130px;
}
a.tooltip:hover span{
display:inline;
position:absolute;
background:#ffffff;
border:1px solid #cccccc;
color:#6c6c6c;
}
a[href$='.doc'] {
padding:0 20px 0 0;
background:transparent url(/graphics/icons/doc.gif)
no-repeat center rightright;
}

a[href$='.pdf'] {
padding:0 20px 0 0;
background:transparent url(/graphics/icons/pdf.gif )
no-repeat center rightright;
}
.input{
left: -1000px;
position: absolute;
}

.radioOff {
background: url("off.gif") no-repeat scroll 0 50% transparent;
color: #666666;
display: inline;
font: 0.8em/16px Verdana,Arial,Helvetica;
margin: 0;
padding: 2px 2px 2px 20px;
The HTML :
<div class="columns">
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit
  Nulla elementum accumsan.</p>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit
  </p>
  </div>

The CSS:
.columns {
  -moz-column-count: 2;
  -webkit-column-count: 2;
  }

More Related Content

What's hot

Deepak Soni BCA First Year
Deepak Soni BCA First YearDeepak Soni BCA First Year
Deepak Soni BCA First Yeardezyneecole
 
A complete html and css guidelines for beginners
A complete html and css guidelines for beginnersA complete html and css guidelines for beginners
A complete html and css guidelines for beginnersSurendra kumar
 
Efficient, maintainable CSS
Efficient, maintainable CSSEfficient, maintainable CSS
Efficient, maintainable CSSRuss Weakley
 
Web Design Basics for Kids: HTML & CSS
Web Design Basics for Kids: HTML & CSSWeb Design Basics for Kids: HTML & CSS
Web Design Basics for Kids: HTML & CSSAnnMarie Ppl
 
Shaping Up With CSS
Shaping Up With CSSShaping Up With CSS
Shaping Up With CSSsdireland
 
Forms and Databases in PHP
Forms and Databases in PHPForms and Databases in PHP
Forms and Databases in PHPMike Crabb
 
Copy & Paste Design Hacks To Take Your Blog to the Next Level
Copy & Paste Design Hacks To Take Your Blog to the Next LevelCopy & Paste Design Hacks To Take Your Blog to the Next Level
Copy & Paste Design Hacks To Take Your Blog to the Next LevelWishpond
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Gheyath M. Othman
 
Haml. New HTML? (RU)
Haml. New HTML? (RU)Haml. New HTML? (RU)
Haml. New HTML? (RU)Kirill Zonov
 
Links and Navigation
Links and NavigationLinks and Navigation
Links and Navigationsdireland
 
Web Design 101
Web Design 101Web Design 101
Web Design 101vegdwk
 
Designing and Developing Windowed Interfaces for Web Apps
Designing and Developing Windowed Interfaces for Web AppsDesigning and Developing Windowed Interfaces for Web Apps
Designing and Developing Windowed Interfaces for Web AppsSteve Smith
 
Visualizing The Code
Visualizing The CodeVisualizing The Code
Visualizing The Codesdireland
 
Css presentation introdution with sample basic projects
Css presentation introdution with sample basic projectsCss presentation introdution with sample basic projects
Css presentation introdution with sample basic projectsDigital Shende
 
HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1Sanjeev Kumar
 

What's hot (20)

The World of Dynamic Sites
The World of Dynamic SitesThe World of Dynamic Sites
The World of Dynamic Sites
 
Deepak Soni BCA First Year
Deepak Soni BCA First YearDeepak Soni BCA First Year
Deepak Soni BCA First Year
 
A complete html and css guidelines for beginners
A complete html and css guidelines for beginnersA complete html and css guidelines for beginners
A complete html and css guidelines for beginners
 
Efficient, maintainable CSS
Efficient, maintainable CSSEfficient, maintainable CSS
Efficient, maintainable CSS
 
Web Design Basics for Kids: HTML & CSS
Web Design Basics for Kids: HTML & CSSWeb Design Basics for Kids: HTML & CSS
Web Design Basics for Kids: HTML & CSS
 
Shaping Up With CSS
Shaping Up With CSSShaping Up With CSS
Shaping Up With CSS
 
Bhanu pratap
Bhanu pratapBhanu pratap
Bhanu pratap
 
Forms and Databases in PHP
Forms and Databases in PHPForms and Databases in PHP
Forms and Databases in PHP
 
Copy & Paste Design Hacks To Take Your Blog to the Next Level
Copy & Paste Design Hacks To Take Your Blog to the Next LevelCopy & Paste Design Hacks To Take Your Blog to the Next Level
Copy & Paste Design Hacks To Take Your Blog to the Next Level
 
Intro to CSS
Intro to CSSIntro to CSS
Intro to CSS
 
Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1Web Design Course: CSS lecture 1
Web Design Course: CSS lecture 1
 
Html frames
Html framesHtml frames
Html frames
 
Haml. New HTML? (RU)
Haml. New HTML? (RU)Haml. New HTML? (RU)
Haml. New HTML? (RU)
 
Links and Navigation
Links and NavigationLinks and Navigation
Links and Navigation
 
Web Design 101
Web Design 101Web Design 101
Web Design 101
 
Designing and Developing Windowed Interfaces for Web Apps
Designing and Developing Windowed Interfaces for Web AppsDesigning and Developing Windowed Interfaces for Web Apps
Designing and Developing Windowed Interfaces for Web Apps
 
Bs Typography
Bs TypographyBs Typography
Bs Typography
 
Visualizing The Code
Visualizing The CodeVisualizing The Code
Visualizing The Code
 
Css presentation introdution with sample basic projects
Css presentation introdution with sample basic projectsCss presentation introdution with sample basic projects
Css presentation introdution with sample basic projects
 
HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1HTML 5 Simple Tutorial Part 1
HTML 5 Simple Tutorial Part 1
 

Viewers also liked (6)

Beyond the Standards
Beyond the StandardsBeyond the Standards
Beyond the Standards
 
Ignore the DOM
Ignore the DOMIgnore the DOM
Ignore the DOM
 
Intellectual Property Rights : A Primer
Intellectual Property Rights : A PrimerIntellectual Property Rights : A Primer
Intellectual Property Rights : A Primer
 
Dos and Don't during Monsoon!
Dos and Don't during Monsoon!Dos and Don't during Monsoon!
Dos and Don't during Monsoon!
 
J Query
J QueryJ Query
J Query
 
Google +
Google +Google +
Google +
 

Similar to Css tips & tricks

Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style SheetsSenthil Kumar
 
css-note.pptx
css-note.pptxcss-note.pptx
css-note.pptxSamay16
 
Xlrays online web tutorials
Xlrays online web tutorialsXlrays online web tutorials
Xlrays online web tutorialsYogesh Gupta
 
Introduction to css by programmerblog.net
Introduction to css by programmerblog.netIntroduction to css by programmerblog.net
Introduction to css by programmerblog.netProgrammer Blog
 
CSS Layout Tutorial
CSS Layout TutorialCSS Layout Tutorial
CSS Layout Tutorialhstryk
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4Gheyath M. Othman
 
WordPress theme translation
WordPress theme translationWordPress theme translation
WordPress theme translationYoav Farhi
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & CompassRob Davarnia
 
Class 3 create an absolute layout with css abs position (aptana)
Class 3  create an absolute layout with css abs position (aptana)Class 3  create an absolute layout with css abs position (aptana)
Class 3 create an absolute layout with css abs position (aptana)Erin M. Kidwell
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)emrox
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008tutorialsruby
 
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.pptwaxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.pptIsmaciil2
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheetstutorialsruby
 

Similar to Css tips & tricks (20)

CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
css-note.pptx
css-note.pptxcss-note.pptx
css-note.pptx
 
Xlrays online web tutorials
Xlrays online web tutorialsXlrays online web tutorials
Xlrays online web tutorials
 
Theme 23
Theme 23Theme 23
Theme 23
 
Introduction to css by programmerblog.net
Introduction to css by programmerblog.netIntroduction to css by programmerblog.net
Introduction to css by programmerblog.net
 
CSS
CSSCSS
CSS
 
CSS Layout Tutorial
CSS Layout TutorialCSS Layout Tutorial
CSS Layout Tutorial
 
Web Design Course: CSS lecture 4
Web Design Course: CSS  lecture 4Web Design Course: CSS  lecture 4
Web Design Course: CSS lecture 4
 
WordPress theme translation
WordPress theme translationWordPress theme translation
WordPress theme translation
 
Class 10
Class 10Class 10
Class 10
 
Getting Started with Sass & Compass
Getting Started with Sass & CompassGetting Started with Sass & Compass
Getting Started with Sass & Compass
 
Class 3 create an absolute layout with css abs position (aptana)
Class 3  create an absolute layout with css abs position (aptana)Class 3  create an absolute layout with css abs position (aptana)
Class 3 create an absolute layout with css abs position (aptana)
 
Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)Sass & Compass (Barcamp Stuttgart 2012)
Sass & Compass (Barcamp Stuttgart 2012)
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
BloggingWithStyle_2008
BloggingWithStyle_2008BloggingWithStyle_2008
BloggingWithStyle_2008
 
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.pptwaxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
waxaada canshuurahaiyosiyaaddaguudeexamarwaaardaydaDAALBADAN.ppt
 
css1.ppt
css1.pptcss1.ppt
css1.ppt
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 

Recently uploaded

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 

Recently uploaded (20)

Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

Css tips & tricks

  • 2. #page { width: 960px; margin: 0 auto; } The above will center the div with an id of page inside it’s parent container.
  • 3. The HTML: <div id="container">some text here</div> The CSS: div#container {height: 35px; line-height: 35px} If you want to vertically center text within a containing block who’s height is fixed, simply set the line-height of the text to be the same as the height of the containing block
  • 4. Method 1 The HTML: <div id="content">your content here</div> The CSS: div#content {position: absolute; top: 50%; height: 500px; margin-top: -250px} The top left corner of the div will be positioned 50% from the top. Since we want the center of the div to be positioned 50% from the top you need to set a negative top margin equal to half the height of the div. This same trick works for horizontal centering as well. Change top to left and margin-top to margin-left and set the negative margin to be half of the width of the element.
  • 5. Method 2 The HTML : <div id="wrapper"> <div id="cell"> <div class="content"> Content goes here </div> </div> </div> The CSS: #wrapper {display:table;} #cell {display:table-cell; vertical-align:middle;} This method sets some <div>s to display like a table, so we can use the table’s vertical-align property
  • 6. div#button{ background: #888; border: 1px solid; border-color: #999 #777 #777 #999 ; } The CSS above will create a button with the light source at the upper left. Usually one or two shades of color change is all that’s needed, but you can experiment for different effects.
  • 7. body { font: font-style font-variant font-weight font-size line-height font-family; } Would look like this body{font: normal bold 14px 18px arial;} You don’t need to include every property, but know that for any you don’t include that property will be reset to it’s default.
  • 8. div#content {width: 580px} *html body div#content {width: 600px} IE7 specifically with *+html body div#content {width: 620px}
  • 9. .element { min-height: 500px height: auto !important height: 500px } For IE6 .element { min-height: 500px _height: 500px }
  • 10. Element, Pseudo Element d = 1 – (0,0,0,1) Class, Pseudo class, Attribute c = 1 – (0,0,1,0) Id b = 1 – (0,1,0,0) Inline Style: a = 1 – (1,0,0,0) p: 1 element – (0,0,0,1) div: 1 element – (0,0,0,1) #sidebar: 1 id – (0,1,0,0) div#sidebar: 1 element, 1 id – (0,1,0,1) div#sidebar p: 2 elements, 1 id – (0,1,0,2) div#sidebar p.bio: 2 elements, 1 class, 1 id – (0,1,1,2)
  • 11. triangle { border-color: transparent transparent green transparent; border-style: solid; border-width: 0px 300px 300px 300px; height: 0px; width: 0px; }
  • 12. .cirlce { width: 300px; height: 300px; background-color: red; border-radius: 150px; -moz-border-radius: 150px; -webkit-border-radius: 150px; }
  • 13. Preventing: h1 { white-space:nowrap; } Sometimes the text in a link or heading will break where you don’t want it to Adding: HTML: <p><span>hello></span><span>How are you</span></p> CSS: p span { display: block; }
  • 15. a {outline: none} or a {outline: 0}
  • 16. @font-face { font-family: 'LeagueGothic'; src: url(LeagueGothic.otf); } header { font-family: 'LeagueGothic'; }
  • 17. div { text-overflow: ellipsis; } A long cold winter delayed the blossoming …
  • 18. color: rgba(255, 0, 0, 0.75); background: rgba(0, 0, 255, 0.75);
  • 19. .multibg { background: url(src/zippy-plus.png) 10px center no-repeat, url(src/gray_lines_bg.png) 0 center repeat-x; }
  • 21. The HTML : <a href="#" class="tooltip">Tooltip<span> Extra info </span></a> The CSS : a:hover { background:#ffffff; /*BG color is a must for IE6* text-decoration:none; } a.tooltip span { display:none; padding:2px 3px; margin-left:8px; width:130px; } a.tooltip:hover span{ display:inline; position:absolute; background:#ffffff; border:1px solid #cccccc; color:#6c6c6c; }
  • 22. a[href$='.doc'] { padding:0 20px 0 0; background:transparent url(/graphics/icons/doc.gif) no-repeat center rightright; } a[href$='.pdf'] { padding:0 20px 0 0; background:transparent url(/graphics/icons/pdf.gif ) no-repeat center rightright; }
  • 23. .input{ left: -1000px; position: absolute; } .radioOff { background: url("off.gif") no-repeat scroll 0 50% transparent; color: #666666; display: inline; font: 0.8em/16px Verdana,Arial,Helvetica; margin: 0; padding: 2px 2px 2px 20px;
  • 24. The HTML : <div class="columns"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit Nulla elementum accumsan.</p> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit </p> </div> The CSS: .columns { -moz-column-count: 2; -webkit-column-count: 2; }