CSS CSS. selector { property: value; } 3/20/2018. CSS: Cascading Style Sheets

Similar documents
CS193X: Web Programming Fundamentals

CSS.

Assignments (4) Assessment as per Schedule (2)

Chapter 3 Style Sheets: CSS

Block & Inline Elements

VRIJEDNOSTI ATRIBUTA

CS193X: Web Programming Fundamentals

CS193X: Web Programming Fundamentals

CSS Cascading Style Sheets

CE419 Web Programming. Session 3: HTML (contd.), CSS

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

COMS 359: Interactive Media

CSS. Shan-Hung Wu CS, NTHU

CSS Cascading Style Sheets

PREDMET. Osnove Java Programiranja. Čas JAVADOC

Cascading Style Sheets Level 2

Osnove programskog jezika C# Čas 5. Delegati, događaji i interfejsi

CSS: Cascading Style Sheets

Introduction to WEB PROGRAMMING

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

CSS: Lists, Tables and the Box Model

ITNP43: HTML Lecture 4

Cascading Style Sheets (CSS)

Web Site Design and Development Lecture 9. CS 0134 Fall 2018 Tues and Thurs 1:00 2:15PM

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style

CSS: The Basics CISC 282 September 20, 2014

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo

CSS

Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework

HTML and CSS COURSE SYLLABUS

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

Downloads: Google Chrome Browser (Free) - Adobe Brackets (Free) -

Parashar Technologies HTML Lecture Notes-4

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

Adding CSS to your HTML

CSS: Cascading Style Sheets

1/6/ :28 AM Approved New Course (First Version) CS 50A Course Outline as of Fall 2014

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Introduction to using HTML to design webpages

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values

Zen Garden. CSS Zen Garden

.hedgehog { background-image: url(backyard.jpg); color: #ffff99; height: 6in; width: 12in; } .tube {

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

CSS Selectors. element selectors. .class selectors. #id selectors

Web Development and HTML. Shan-Hung Wu CS, NTHU

Data Visualization (CIS/DSC 468)

Creating and Building Websites

HTMLnotesS15.notebook. January 25, 2015

Web Engineering CSS. By Assistant Prof Malik M Ali

Styles, Style Sheets, the Box Model and Liquid Layout

Deccansoft Software Services

3. Each of these mark examples contains an error. a. <input name= country value= Your country here. /> b. <checkbox name= color value= teal />

Reading 2.2 Cascading Style Sheets

COMS 359: Interactive Media

Programmazione Web a.a. 2017/2018 HTML5

Računarske osnove Interneta (SI3ROI, IR4ROI)

Cascading Style Sheet Quick Reference

Using CSS for page layout

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors

INTRODUCTION TO CSS. Topics MODULE 5

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations

Data Visualization (DSC 530/CIS )

Appendix D CSS Properties and Values

CSS. Lecture 16 COMPSCI 111/111G SS 2018

CHAPTER 4 CASCADING STYLE SHEETS BASICS KEY CONCEPTS

HTML and CSS a further introduction

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

CMPT 165: More CSS Basics

VB komande. Programiranje 1

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Introduction to HTML & CSS. Instructor: Beck Johnson Week 2

CSS: formatting webpages

CSS. M hiwa ahamad aziz Raparin univercity. 1 Web Design: Lecturer ( m hiwa ahmad aziz)

CSCB20 Week 7. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

ITNP43: HTML Lecture 5

CSS Lecture 16 COMPSCI 111/111G SS 2018

BIM222 Internet Programming

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 2

Cascading Style Sheets CSCI 311

HTML Organizing Page Content

Vežbe - XII nedelja PHP Doc

CSS for Styling CS380

CSS WHAT IS IT? HOW DOES IT WORK? (LOOK N GOOD)

Web Development & Design Foundations with HTML5

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

Review Question 1. Which tag is used to create a link to another page? 1. <p> 2. <li> 3. <a> 4. <em>

LING 408/508: Computational Techniques for Linguists. Lecture 14

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015

Web Development & Design Foundations with HTML5

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

Introduction to Web Design CSS Reference

To Ponder. Which one wins? .draft div.warning li { }.draft div #main li {!important; } div #main ul li { }.draft.warning ul li { }

EECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling

Cascading Style Sheet

ID1354 Internet Applications

INTRODUCTION TO CSS. Mohammad Jawad Kadhim

Programiranje III razred

Transcription:

CSS CSS CSS: Cascading Style Sheets - Opisuje izgled (appearance) i raspored (layout) stranice - Sastoji se od CSS pravila, koji defini[u skup stilova selector { property: value; 1

Font face: font-family Neka CSS svojstva Font color: color Svosjtvo color se uvijek odnosi na boju font-a color, i ne postoji način da bude bilo što drugo. Background color: background-color Postvalja background-color elementa body. Neka CSS svojstva Border: border (border shorthand syntax) Text alignment: text-align (napomena: ne koristite <center>) 2

CSS boje 140 predefined names (list) color: black; Hex values color: #00ff00; color: #0f0; color: #00ff0080; - "a" u rgba predstavlja tzv. alpha channel - transparency value - Birajte po volji : 1. Predefined name 2. rgb / rgba 3. Hex rgb() i rgba() color: rgb(34, 12, 64); color: rgba(0, 0, 0, 0.5); Exercise: Course web page Let's write some CSS to style our page: CodePen link: Follow along! 3

Exercise: Course web page Font face: Helvetica Border: hotpink 3px Background color: lavenderblush Highlight: yellow Let's write some CSS to style our page: - Box is centered - Header and link are centered - Box contents are leftaligned CodePen link: Follow along! Primjer body { font-family: Helvetica; Izgled: h1 { text-align: center; a { text-align: center; p { border: 3px solid hotpink; background-color: lavenderblush; 4

CSS dobra praksa Neke važne napomene: - Dodati nevidljive kontejnere u HTML da bi selektovali grupe elementa u CSS-u. - Primjenjujte stilove na parent / ancestor elemente da bi stilizovali roditelje (parents) i svu njihovu djecu Tipovi HTML elemenata Svaki HTML element pripada jednoj od tri kategorije: 1. block : veliki blok nekog sadržaja, ima height i width <p>, <h1>, <blockquote>, <ol>, <ul>, <table> 2. inline: mali sadržaj, nema height ili width <a>, <em>, <strong>,<br> a. inline block: inline sadržaj koji ima height i width <img> 3. metadata: informacije o stranici, obično nisu vidljive <title>, <meta> 5

Block elementi Primjeri: <p>, <h1>, <blockquote>, <ol>, <ul>, <table> - Zauzimaju cijelu širinu stranice (flows top to bottom) - Imaju height i width - Mogu imati block ili inline elemente kao djecu Primjer: Block <h1>about vrk</h1> <p> She likes <em>puppies</em> </p> 6

Q: Kako će izgledati u browseru? h1 { border: 5px solid red; <h1>about vrk</h1> <p> She likes <em>puppies</em> </p> (Codepen) 7

Q: Kako će izgledati u browseru? h1 { border: 5px solid red; width: 50%; <h1>about vrk</h1> <p> She likes <em>puppies</em> </p> (Codepen) 8

Inline elementi Primjeri: <a>, <em>, <strong>, <br> - Zauzimaju širinu koiko im treba (flows left to right) - Ne mogu imati height i width - Ne mogu imati djecu block elemente - Ne mogu se pozicionirati (tj. CSS svosjtva kao float i position se ne primjenjuju na inline elemente) Mora se pozicionirati block element koji ih sadrži Primjer: Inline <strong>web programming resources:</strong> <a href="http://cs193x.stanford.edu">cs 193X</a> <a href="https://developer.mozilla.org/en-us/">mdn</a> <a href="http://google.com">google</a> 9

Q: Kako će izgledati u browseru? strong { border: 5px solid red; width: 1000px; <strong>web programming resources:</strong> <a href="http://cs193x.stanford.edu">cs 193X</a> <a href="https://developer.mozilla.org/en-us/">mdn</a> <a href="http://google.com">google</a> (Codepen) 10

Inline elementi ignorišu width width se ne može modifikovati strong { border: 5px solid red; width: 1000px; /* Will not work; strong is inline! */ <strong>web programming reso <a href="http://cs193x.stanf <a href="https://developer.m <a href="http://google.com"> Ne može se postaviti width za inline element, pa se ignoriše (Codepen) inline-block Primjer: <img>, bilo koji element sa display: inline-block; - Width je širina sadržaja, tj. zauzima onoliko prostora koliko treba sadržaju (flows left to right) - Može imati height i width - Može imati dijete koje je block - Može se poyicionirati (tj. CSS svojstva float i position se mogu primijeniti) 11

Primjer: Inline-block img { width: 50px; Q: Kako će izgledati u browseru? http://i.imgur.com/wjtovgv.jpg = (Codepen) 12

Inline-block Ima width i height; flows left to right Može se postaviti width za inline-block element, pa slika ima širinu 50px. (Codepen) inline-block flows left to right, pa su slike jedna uz drugu. img { width: 50px; Svojstvo display Može se promijeniti podrazumijevani način iscrtavanja (render) elementa promjenom svojstva display. Primjeri: p { display: inline; a { display: block; Moguće vrijednosti za display: - block - inline - inline-block - Ostale vrijednosti : link 13

Ukratko 1. block : flows top-to-bottom; imaju height i width <p>, <h1>, <blockquote>, <ol>, <ul>, <table> 2. inline: flows left-to-right; nemaju height i width <a>, <em>, <strong>,<br> a. inline block: flows left-to-right; imaju height i width jednake veličini sadržaja <img> Naravoučenije: Ako vaš CSS ne radi provjerite da li ste primjenjivali svojstva blok elemenata na inline elemente 14

<div> i <span> Dva generička taga: <div>: generički block element <span>: generički inline element <span> u akciji Koristimo <span> kao generički inline HTML kontejner: 15

Više generičkih kontejnera? Da li često trebamo više generičkih kontejnera? Kako da razlikujemo dva generička kontejnera? Drugim roječima kako izabrati podskup elementa na stranici a ne sve elemente? CSS Selectori: Classes i Ids 16

Classes and ids Postoje 3 osnovna tipa selektora: Selektor elementa selector p Svi <p> elementi ID selektor #abc element sa id="abc" Class selektor.abc elements sa class="abc" <h1 id="title">homework</h1> <em class="hw">hw0</em> is due Friday.<br/> <em class="hw">hw1</em> goes out Monday.<br/> <em>all homework due at 11:59pm.</em> Classes and ids <h1 id="title">homework</h1> <em class="hw">hw0</em> is due Friday.<br/> <em class="hw">hw1</em> goes out Monday.<br/> <em>all homework due at 11:59pm.</em>.hw { color: hotpink; #title { color: purple; 17

Još o class i id class iid specijalni HTML atributi koji se mogu koristiti sa svim HTML elementima class: jedan ili više elemenata; identifikuje skup elemenata id: tačno jedan element na stranci; identifikuje jedinstveni element Može i više klasa odjednom : <span class="hw new">hw1</span> Često se koristi sa span i div generičkim elementima: npr. <span class="highlight"> je kao kreiranje elementa "highlight" 18