http://slides.com/tennisbear/cbcdt
San Diego PHP Meetup Group
http://slides.com/tennisbear/cbcdt
San Diego PHP Meetup Group
Dennis Slade Jr.
tennisbear@gmail.com
14 years experience with PHP/MySQL in *AMP environments
30+ years providing tech support to Mom
CSS (Cascading Style Sheets) tells web browsers in excruciating detail how to layout the HTML they are receiving.
CSS helps HTML display properly for all
types of screen sizes and printers.
The proliferation of retina displays and varied mobile devices complicates the use of px and pt for font sizes.
Use em to enable relative, cascading font size changes.
Rem isn't available yet in all browsers but it's coming.
You have content you've read from the database that you need to display statically, but it could possibly overflow the display area.
PHP Solution:
Get first n characters using substr() then add "..." to the end.
CSS Solution:
text-overflow: ellipsis;
You're pulling a large amount of textual content from the database, and the content has lots of big words. Your customer is requesting you hyphenate the content if at all possible.
Tell them how tricky it's going to be, then just use this:
-webkit-hyphens: auto; -ms-hyphens: auto; hyphens: auto;
(Limited Chrome support, IE 10+)
A page has a sticky navigation header and a table of contents whose links are anchors further down in the page. Clicking the links always leaves content stuck underneath the navigation header.
Go all jQuery on it, or just apply this class to the anchors:
a.toc-target:target:before { content: ""; display: block; height: 80px; margin: -80px 0 0; }
[ ex ]
You have a table created by a succession of <div> or <ul> elements. You need different styles applied to the header row, odd and even rows, and to the final row.
PHP Solution:
As you generate the HTML, use a counter to specify different/additional classes for the header row, even rows, odd rows, and the final row.
You have a table created by a succession of <div> or other block elements. You need different styles applied to the header row, odd and even rows, and to the final row.
CSS Solution: Use pseudo classes.
.sl-standings div.listing:NTH-CHILD(2n+0) {
background-color:#DDD;
}
.sl-standings div.listing:LAST-CHILD {
background-color:salmon;
}
[ ex ]
You have a table created by a succession of <div> or <ul> elements. You need different styles applied to the header row, odd and even rows, and to the final row.
PHP Solution:
As you generate the HTML, output $counter in its own cell. You'll probably have to output ($counter+1) because you have a zero-based PHP array being viewed by ones-based humans.
You have a table created by a succession of <div> or <ul> elements. You need different styles applied to the header row, odd and even rows, and to the final row.
CSS Solution:
.counter-parent { counter-reset:ranking; }
.counter-parent span.counter:BEFORE {
counter-increment: ranking 2;
content:counter(ranking);
}
[ ex ]
Bootstrap is a very popular CSS/JS front-end framework for developing responsive and mobile web projects.
Bootstrap's set of shorthand CSS classes are recognized by developers throughout the tech world and in most companies and industries.
Created in 2010 by two former Twitter employees, Bootstrap is now proudly open source.
[ 1 ]
(this was)
• Mail: tennisbear@gmail.com
• LinkedIn: linkedin.com/in/dennissladejr
• Twitter: @DennisSladeJr
This presentation on Slides.com: