CSCI-UA 4 Lecture Notes - Lecture 7: Html Element, Html Attribute, Block Elements
Document Summary
We can apply color or images to the background of html elements. The following are background css properties: background-color background-image background-repeat background-attachment background-position. You can have a background image go full screen on any element. Here is an example applying these rules to the tag: html { background: url(exebg. jpg) no-repeat center center fixed; To center content we can do it simply by using the following rule: p { text-align:center; To center block element we can do it simply by using the following rules: div{ width:960px; margin:0 auto; Note: a block element is by default 100% of width, in order for it to be centered you need to set the width to be less than the width of its parent element. There are four ways to specify color in css: Hexadecimal: color:#000; or color:#000000; (0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f where 0 is black and f is white) . tip: use photoshop or gimp or from your mac"s digital color meter app to sample colors.