Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use --col var instead of aside #2

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Demo: https://vladocar.github.io/Basic.css/

This project uses the best elements from my previous projects:

https://github.com/vladocar/Basic-CSS-Typography-Reset
https://github.com/vladocar/infinity-css-grid
https://github.com/vladocar/Simple-Button
https://github.com/vladocar/Basic-CSS-Typography-Reset
https://github.com/vladocar/infinity-css-grid
https://github.com/vladocar/Simple-Button

##### You can change root css variables with your color palette:

Expand Down Expand Up @@ -66,24 +66,30 @@ By default are 8px, use --rc: 0px; if you don't like round corners.

##### How you can use the infinity flex grid?

Use the HTML5 tags selection and aside to make flex grid.
Use the HTML5 tags section and --col CSS variable to make flex grid.

```html
<section>
<aside> 1 </aside>
<aside> 2 </aside>
<aside> 3 </aside>
<div style="--col:1"> 1 </div>
<div style="--col:1"> 2 </div>
<div style="--col:1"> 3 </div>
</section>
<section>
<aside> 1 </aside>
<aside> 2 </aside>
<aside> 3 </aside>
<aside> 4 </aside>
<div style="--col:1">1</div>
<div style="--col:2">2</div>
<div style="--col:1">3</div>
</section>
<section>
<div style="--col:1"> 1 </div>
<div style="--col:2"> 2 </div>
<div style="--col:3"> 3 </div>
<div style="--col:2"> 4 </div>
<div style="--col:1"> 5 </div>
</section>
```
Demo: https://vladocar.github.io/Basic.css/grid.html

Use the HTML5 tags selection and article to make cards.
Use the HTML5 tags section and article to make cards.

```html
<section>
Expand Down
4 changes: 2 additions & 2 deletions css/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ button:hover,button:focus,input:hover,textarea:hover,select:hover {opacity: 0.8}

section{display: flex; flex-flow: row wrap}

aside,article {flex:1; margin:var(--m1)}
*[style*="--col:"],article {flex:var(--col,1); margin:var(--m1)}

/* Cards */

article {background: var(--c2); border-radius: var(--rc); padding: 1em; box-shadow: 0px 1px 0px rgba(0,0,0,0.3)}

aside:first-child, article:first-child {margin-left:0}
*[style*="--col:"]:first-child, article:first-child {margin-left:0}
2 changes: 1 addition & 1 deletion css/basic.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 26 additions & 27 deletions grid.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,38 @@
text-align: left;
padding: 0 20px;
}
aside{
color: #fff;
background-color: #00bbeb;
padding: 15px;
margin: 10px 8px 10px 8px;
text-align: center;
}
*[style*="--col:"] {
color: #fff;
background-color: #00bbeb;
padding: 15px;
margin: 10px 8px 10px 8px;
text-align: center;
}
</style>

</head>

<body>
<main>

<section>
<aside> 1 </aside>
<aside> 2 </aside>
<aside> 3 </aside>
</section>
<section>
<aside>1</aside>
<aside>2</aside>
<aside>3</aside>
<aside>4</aside>
</section>
<section>
<aside> 1 </aside>
<aside> 2 </aside>
<aside> 3 </aside>
<aside> 4 </aside>
<aside> 5 </aside>
</section>
</main>

<section>
<div style="--col:1"> 1 </div>
<div style="--col:1"> 2 </div>
<div style="--col:1"> 3 </div>
</section>
<section>
<div style="--col:1">1</div>
<div style="--col:2">2</div>
<div style="--col:1">3</div>
</section>
<section>
<div style="--col:1"> 1 </div>
<div style="--col:2"> 2 </div>
<div style="--col:3"> 3 </div>
<div style="--col:2"> 4 </div>
<div style="--col:1"> 5 </div>
</section>
</main>
</body>

</html>
64 changes: 32 additions & 32 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
padding: 0 20px;
}

aside {
*[style*="--col:"] {
color: #fff;
background-color: var(--c1);
padding: 15px;
Expand All @@ -27,7 +27,7 @@

@media (max-width: 481px) {
main,footer {width: 98%}
aside,article {flex:none; width:100%; margin-left: 0;}
*[style*="--col:"],article {flex:none; width:100%; margin-left: 0;}
}
</style>

Expand Down Expand Up @@ -64,7 +64,8 @@ <h4>Dark Theme</h4>
<article>
<img src="img/grid.svg" />
<h4>Flex Grid without classes</h4>
<p>By putting <b>aside</b> tag inside <b>selection</b> tag container you could make infinite flex grid.
<p>By putting <b>style="--col:N"</b> attribute on an element inside <b>section</b> tag container you could make
infinite flex grid.
</p>
</article>
<article>
Expand Down Expand Up @@ -170,27 +171,26 @@ <h3>Infinity Grid</h3>


<section>
<aside> 1 </aside>
<aside> 2 </aside>
<aside> 3 </aside>
<div style="--col:1"> 1 </div>
<div style="--col:1"> 2 </div>
<div style="--col:1"> 3 </div>
</section>
<section>
<aside>1</aside>
<aside>2</aside>
<aside>3</aside>
<aside>4</aside>
<div style="--col:1">1</div>
<div style="--col:2">2</div>
<div style="--col:1">3</div>
</section>
<section>
<aside> 1 </aside>
<aside> 2 </aside>
<aside> 3 </aside>
<aside> 4 </aside>
<aside> 5 </aside>
<div style="--col:1"> 1 </div>
<div style="--col:2"> 2 </div>
<div style="--col:3"> 3 </div>
<div style="--col:2"> 4 </div>
<div style="--col:1"> 5 </div>
</section>


<h3>Forms</h3>

<form>
<p>
<label for="Name">Name:</label><br />
Expand All @@ -209,41 +209,41 @@ <h3>Forms</h3>
<textarea id="Message" name="Message"></textarea>
</p>
<p>
<label>Lorem ipsum</label><br />
<select id="lorem" name="Lorem ipsum">
<option selected="selected" value="1">Lorem ipsum</option>
<option value="2">dolor sit amet</option>
<option value="3"> consectetuer adipiscing</option>
<option value="4">vitae diam</option>
<option value="5">Vestibulum ornare</option>
</select>
<label>Lorem ipsum</label><br />
<select id="lorem" name="Lorem ipsum">
<option selected="selected" value="1">Lorem ipsum</option>
<option value="2">dolor sit amet</option>
<option value="3"> consectetuer adipiscing</option>
<option value="4">vitae diam</option>
<option value="5">Vestibulum ornare</option>
</select>
</p>
<p>
<label>Number:</label><br />
<input type="radio" name="radioSet" value="uno" />Uno<br />
<input type="radio" name="radioSet" value="due" />Due<br />
<input type="radio" name="radioSet" value="tre" />Tre<br />
<input type="radio" name="radioSet" value="uno" />Uno<br />
<input type="radio" name="radioSet" value="due" />Due<br />
<input type="radio" name="radioSet" value="tre" />Tre<br />
</p>
<p>
<button>Button </button>
<button>Hello World</button>

</p>


</form>

<p><b><a href="https://github.com/vladocar/Basic.css">Download the project on Github</a></b></p>

<hr>
</main>
<footer>
<footer>

<p>Made with ❤️ by <a href="https://github.com/vladocar">@vladocar</a> </p>
</footer>
</footer>




</body>

</html>