Skip to content

Instantly share code, notes, and snippets.

View amelieykw's full-sized avatar

amelieykw amelieykw

  • Sophia Antipolis, France
View GitHub Profile
@amelieykw
amelieykw / sort_divs.css
Last active July 13, 2021 13:12
[jQuery - sort divs - by 'data-' attribute] #jQuery #javascript #sort_divs
div[data-percentage] {
font-family: sans-serif;
background: teal;
padding: 10px;
font-weight: bold;
color: #023636;
text-shadow: 0 1px 0 #58BBBB;
font-size: 20px;
width: 100px;
margin: 4px auto;
@amelieykw
amelieykw / 00 - Introduction.md
Created April 5, 2018 14:49
[Bootstrap Sidebar] #Bootstrap #Sidebar
@amelieykw
amelieykw / 00 - Introduction.md
Last active July 21, 2020 21:22
[How TO - Filter DIV Elements] #w3school #How TO -#Filter-Elements #HTML #CSS #javascript

Learn how to filter a DIV element based on it's class name.

@amelieykw
amelieykw / Create An Accordion.html
Last active April 5, 2018 15:15
[How TO - Collapsibles/Accordion] #w3school #How TO #Collapsibles/Accordion
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
@amelieykw
amelieykw / truncate_long_text.md
Created April 6, 2018 15:13
[Use CSS "text-overflow" to truncate long texts] #CSS #HTML #truncate_long_text #text-overflow

When using Rails to truncate strings, you may end up with strings that are still too long for their container or are not as long as they could be. You can get a prettier result using stylesheets.

The CSS property text-overflow: ellipsis has been around for quite a long time now but since Firefox did not support it for ages, you did not use it. Since Firefox 7 you can!

Note that this only works for single-line texts.

If you want to truncate tests across multiple lines, use a JavaScript solution like Superclamp. There is also -webkit-line-clamp which works only on Chrome.

Example

Consider this HTML and Sass for a box that is not wide enough for its content:

@amelieykw
amelieykw / 00 - Content.md
Last active April 10, 2018 08:06
[BOOTSTRAP SIDEBAR] #Bootstrap #Sidebar #Collapsible
@amelieykw
amelieykw / tab-like-div.css
Created April 6, 2018 15:59
[How to tab-like div] #div #tab #HTML #CSS
.tabs {
text-align:right;
}
.tab {
padding:.5em 3em;
display:inline-block;
}
.tab2,
.content{
background:#ccc;
@amelieykw
amelieykw / 00 - Content.md
Last active April 9, 2018 09:30
[The Best Way to Implement a “Wrapper” in CSS]#wrapper #CSS #HTML #CSS-tricks

Original Website

  • "Wrapper" vs "Container"
  • width vs max-width
  • Additional Padding
  • Which HTML Element to Choose
  • Using the <body> tag vs. Using an additional <div>

Sometimes the first bit of HTML we write in a new document is an element that wraps everything else on the page.

@amelieykw
amelieykw / 00 - Content.md
Last active April 9, 2018 12:44
[Box Sizing]#Box-Sizing #CSS #HTML #CSS-tricks
  • Box Model Histroy
  • Present-Day box-sizing
  • Demo
  • Good, Better, and (Probably) Best box-sizing Reset Methods
    • The "Old" border-box Reset
    • Universal Box Sizing
    • Universal Box Sizing with Inheritance
  • Vendor Prefixes
@amelieykw
amelieykw / 00 - HOME.md
Last active April 10, 2018 08:09
[W3.CSS Tutorial] #W3.CSS #tutorial #responsive #CSS #HTML #colors #background-color #text-color #hover-color #Sidebar

Faster and Better

Fully Responsive CSS

What is W3.CSS?

W3.CSS is a modern CSS framework with built-in responsiveness:

Smaller and faster than any other CSS frameworks. Easier to learn, and easier to use than any other CSS frameworks. Better cross-browser compatibility than any other CSS frameworks.