Lab 2 - Cascading Style SheetsStyling with the STYLE attributeStyle attribute allows configuring look and feel right on the element. Although it's very convenient it is considered bad practice and you should avoid using the style attribute Hello my name is Zhenming Gao Lorem ipsum dolor sit amet consectetur adipisicing elit. Suscipit itaque velit accusantium provident iste odit libero modi quo a aspernatur, quod dolorem ducimus omnis voluptate hic in, non perferendis neque! ID selectorsInstead of changing the look and feel of all the elements of the same name, e.g., P, we can refer to a specific element by its ID Here's another paragraph using a different ID and a different look and feel AI2 Hi again. Class selectorsInstead of using IDs to refer to elements, you can use an element's CLASS attribute This heading has same style as paragraph abovewd-your-class here. wd-your-class above.wd-ai-class-selector here wd-ai-class-selector aboveDocument structure selectorsSelectors can be combined to refer elements in particular places in the document This paragraph's red background is referenced as Nested depth is 5 wd-ai-cascade here ColorsForeground colorThe text in this paragraph is red but this text is green wd-ai-fg hereĀ wd-fg-color-black here The text in this paragraph is blue but this text is red Background colorThis background of this paragraph is red but the background of this text is green and the foreground white p block with high contra ai p block with high contra BordersSolid fat red border Dashed thin blue border thin and dashed and blue border ai's fat and dashed and yellow border PaddingPadded top left Padded bottom right Padded all around + Huge padding top (50px) left (300px) wd-ai-padded: 200px MarginsMargin bottom Margin left right Margin all around Box modelparent background (shows through the margin) border (the red ring)padding content margin: the 20px gray gap (transparent)box-sizingcontent-box: width 200px plus padding and border border-box: width 200px includes padding and border ai: this box uses border-box border-box width: 500px; Rounded cornersRounded corners on the top Rounded corners at the bottom Rounded corners all around Different rounded corners + Another Different rounded corners wd-ai-corners DimensionPortrait Landscape Square we are given width 200px and height 100px so the text overflows but the size of the block stays put The quick brown fox jumps over the lazy dog DisplayInlineInline 1Inline 2Inline 3 Inline-blockInline-block 1Inline-block 2Inline-block 3 BlockBlock 1Block 2Block 3 wd-ai-display sample div Force inlineblock here but force inline with wd-display-inline PositionsRelativePortrait Landscape Square wd-ai-relative nudges itself with right 10px and bottom 100px Absolute positionPortrait Landscape Square another wd-ai-absolute Fixed positionCheckout the blue square that says "Fixed position" stuck all the way on the right and half way down the page. It doesn't scroll with the rest of the page. Its position is "Fixed".Fixed position AI fixed fixed corner Z indexPortrait Landscape Square BACK wd-ai-zindex Floatfloat left Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eius hic reprehenderit doloremque adipisci iste deserunt. Inventore, hic. Esse nihil unde aut, dignissimos eos consequatur veniam distinctio? Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eius hic reprehenderit doloremque adipisci iste deserunt. Inventore, hic. Esse nihil unde aut, dignissimos eos consequatur veniam distinctio? Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eius hic reprehenderit doloremque adipisci iste deserunt. Inventore, hic. Esse nihil unde aut, dignissimos eos consequatur veniam distinctio? Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eius hic reprehenderit doloremque adipisci iste deserunt. Inventore, hic. Esse nihil unde aut, dignissimos eos consequatur veniam distinctio? Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eius hic reprehenderit doloremque adipisci iste deserunt. Inventore, hic. Esse nihil unde aut, dignissimos eos consequatur veniam distinctio? Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eius hic reprehenderit doloremque adipisci iste deserunt. Inventore, hic. Esse nihil unde aut, dignissimos eos consequatur veniam distinctio? Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eius hic reprehenderit doloremque adipisci iste deserunt. Inventore, hic. Esse nihil unde aut, dignissimos eos consequatur veniam distinctio? Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eius hic reprehenderit doloremque adipisci iste deserunt. Inventore, hic. Esse nihil unde aut, dignissimos eos consequatur veniam distinctio?Yellow Blue Red ![]() wd-ai-float Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eius hic reprehenderit doloremque adipisci iste deserunt. Inventore, hic. Esse nihil unde aut, dignissimos eos consequatur veniam distinctio?Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eius hic reprehenderit doloremque adipisci iste deserunt. Inventore, hic. Esse nihil unde aut, dignissimos eos consequatur veniam distinctio?Grid layoutLeft halfRight halfMain content20% float 50% float FlexColumn 1 Column 2 Column 3 Column 1 Column 2 Column 3 Column 1 Column 2 Column 3 75px grow 75px left stays, right shrinks grow Media Query DemoThis demo uses CSS media queries to change colors based on screen width:
React Icons SamplerAI: |