Bitcoin Forum
April 24, 2014, 10:21:52 AM *
News: Due to the OpenSSL heartbleed bug, changing your forum password is recommended.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: CSS help with micro-templating...  (Read 826 times)
Alex Beckenham
Full Member
***
Offline Offline

Activity: 154


View Profile

Ignore
June 01, 2011, 05:28:07 AM
 #1

Hi,

I don't even know if this is possible but it seems like it should be...

I'd like to build a 'building block' of html which will then be reused in multiple places in my page.

So let's say i have the following which I'd like to class as 'atom':

Code:
.atom {
   width:1px;
   height:1px;
   background-color:red;
}

Then have another class called a 'molecule'... Is it possible to define each molecule as containing exactly 3 atoms, without specifically hard-coding 3 atoms into every molecule div?

Then later what if I want to have:

<div class='goo'>
</div>

...which automatically displays 100 molecules.


So then after my CSS is set up, the HTML to display 300 atoms would simply be:

Code:
<html>
<body>
<div class='goo'>
</div>
</body>
</html>

Is that possible? How to do it?

Thanks Cheesy

1398334912
Hero Member
*
Offline Offline

Posts: 1398334912

View Profile Personal Message (Offline)

Ignore
1398334912
Reply with quote  #2

1398334912
Report to moderator
1398334912
Hero Member
*
Offline Offline

Posts: 1398334912

View Profile Personal Message (Offline)

Ignore
1398334912
Reply with quote  #2

1398334912
Report to moderator
1398334912
Hero Member
*
Offline Offline

Posts: 1398334912

View Profile Personal Message (Offline)

Ignore
1398334912
Reply with quote  #2

1398334912
Report to moderator
Unbeatable Service & Product Support
Grab Your Miners at GAWMiners.com
Order Before April 25th to receive
Double your Hashing Power for 1 week!

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1398334912
Hero Member
*
Offline Offline

Posts: 1398334912

View Profile Personal Message (Offline)

Ignore
1398334912
Reply with quote  #2

1398334912
Report to moderator
1398334912
Hero Member
*
Offline Offline

Posts: 1398334912

View Profile Personal Message (Offline)

Ignore
1398334912
Reply with quote  #2

1398334912
Report to moderator
JackRabiit
Hero Member
*****
Offline Offline

Activity: 1162


Okey Dokey Lokey


View Profile

Ignore
June 01, 2011, 05:38:49 AM
 #2

Im assuming you can do some form of Targeting when wanting to refer to a set of rules that you created

Alex Beckenham
Full Member
***
Offline Offline

Activity: 154


View Profile

Ignore
June 01, 2011, 05:39:19 AM
 #3

Im assuming you can do some form of Targeting when wanting to refer to a set of rules that you created

Guh?

I can't do much. I just want to define an atom has having a certain look (css, html, images, whatever) and then be able to place that many times in the html without specifically copying and pasting all of the HTML associated with that small block.

Does CSS have a system of sub-classes and sub-sub-classes?

This is how I envisage things:

Code:
.atom {
  width:1px;
  height:1px;
  background-color:red;
}

.molecule {
   atom
   atom
   atom
}

.goo {
   molecule
   molecule
   ...
   molecule
   molecule
}

<div class='goo'>
</div>

spleeder
Jr. Member
*
Offline Offline

Activity: 52



View Profile WWW

Ignore
June 01, 2011, 11:26:01 AM
 #4

What you want to achieve has nothing to do with CSS. You can do it with Javascript.

Bitcoin Escrow
1PTia7jCZdQUpMakq3ZqfuEeBrvg21U3Ln
Alex Beckenham
Full Member
***
Offline Offline

Activity: 154


View Profile

Ignore
June 01, 2011, 11:47:50 AM
 #5

What you want to achieve has nothing to do with CSS. You can do it with Javascript.

Okay no problem. I wasn't sure.

I've already built the site now anyway with a bit of copy+paste Smiley

Will hopefully have the new site ready in a day or so.

spleeder
Jr. Member
*
Offline Offline

Activity: 52



View Profile WWW

Ignore
June 01, 2011, 12:01:22 PM
 #6

With all the molecules and atoms you made me a bit curios. What is this website about?

Bitcoin Escrow
1PTia7jCZdQUpMakq3ZqfuEeBrvg21U3Ln
Alex Beckenham
Full Member
***
Offline Offline

Activity: 154


View Profile

Ignore
June 01, 2011, 12:07:06 PM
 #7

With all the molecules and atoms you made me a bit curios. What is this website about?

It was just an example.

I have a dice game coming up. Each dice consists of a shadow plus a face, and each dice is in a set of 6, and there are 2 sets.

So I thought there may have been a more hierarchal way of arranging them in the page, but since I'm no CSS guru I've ended up just hard-coding pixel locations with the 'position:absolute' feature.

I'm much more at home doing the graphics in Photoshop than I am cutting it up to HTML afterwards, but the guy I usually hire to do that is busy on something else at the moment, so I'm slowly doing it myself Smiley

drgr33n
Full Member
***
Offline Offline

Activity: 238



View Profile WWW

Ignore
June 01, 2011, 01:12:48 PM
 #8

Although this is probably better suited to be coded in Php java you can do this with CSS but use images instead of colors.

Is AWOL due to financial difficulties. If you have found any of my posts or linuxcoin helpful, help a fellow bitcoin pioneer out and send me some coins Cheesy 1AsY8kT5a3UTkzQ8WjocpfQasGf81ZmAeK all donations are greatly received.
eturnerx
Member
**
Offline Offline

Activity: 70


View Profile WWW

Ignore
June 01, 2011, 02:10:17 PM
 #9

OP what you want to do is not achieveable in HTML/CSS. You need javascript. I'd recommend you start out by learning jQuery. Start with beginner tutorials such as:
http://webdesignerwall.com/tutorials/jquery-tutorials-for-designers

What you're trying to do with the dice... well consider either using images. If you want to draw in javascript then consider using the HTML5 canvas element. Just be careful because HTML5 is only supported in newer browsers.

WatchMine - get Bitcoin prices and pool stats on your Mobile
AntiVigilante
Member
**
Offline Offline

Activity: 98



View Profile

Ignore
June 01, 2011, 08:57:47 PM
 #10

With all the molecules and atoms you made me a bit curios. What is this website about?

It was just an example.

I have a dice game coming up. Each dice consists of a shadow plus a face, and each dice is in a set of 6, and there are 2 sets.

So I thought there may have been a more hierarchal way of arranging them in the page, but since I'm no CSS guru I've ended up just hard-coding pixel locations with the 'position:absolute' feature.

I'm much more at home doing the graphics in Photoshop than I am cutting it up to HTML afterwards, but the guy I usually hire to do that is busy on something else at the moment, so I'm slowly doing it myself Smiley


I take bitcoin (in BTC or dobits (.001 BTCs)). I could make this work.

Proposal: http://forum.bitcoin.org/index.php?topic=11541.msg162881#msg162881
Inception: https://github.com/bitcoin/bitcoin/issues/296
Goal: http://forum.bitcoin.org/index.php?topic=12536.0
Means: Code, donations, and brutal criticism. I've got a thick skin. 1Gc3xCHAzwvTDnyMW3evBBr5qNRDN3DRpq
AntiVigilante
Member
**
Offline Offline

Activity: 98



View Profile

Ignore
June 01, 2011, 11:58:32 PM
 #11

Micro templating is unnecessary.

You can use multiple classes in the class="" attribute.

Proposal: http://forum.bitcoin.org/index.php?topic=11541.msg162881#msg162881
Inception: https://github.com/bitcoin/bitcoin/issues/296
Goal: http://forum.bitcoin.org/index.php?topic=12536.0
Means: Code, donations, and brutal criticism. I've got a thick skin. 1Gc3xCHAzwvTDnyMW3evBBr5qNRDN3DRpq
Alex Beckenham
Full Member
***
Offline Offline

Activity: 154


View Profile

Ignore
June 02, 2011, 01:20:32 AM
 #12

With all the molecules and atoms you made me a bit curios. What is this website about?

It was just an example.

I have a dice game coming up. Each dice consists of a shadow plus a face, and each dice is in a set of 6, and there are 2 sets.

So I thought there may have been a more hierarchal way of arranging them in the page, but since I'm no CSS guru I've ended up just hard-coding pixel locations with the 'position:absolute' feature.

I'm much more at home doing the graphics in Photoshop than I am cutting it up to HTML afterwards, but the guy I usually hire to do that is busy on something else at the moment, so I'm slowly doing it myself Smiley


I take bitcoin (in BTC or dobits (.001 BTCs)). I could make this work.

Thanks, pretty much finished with the graphics and HTML now. It's mainly PHP work from here onwards.

lemonginger
Full Member
***
Offline Offline

Activity: 210


firstbits: 121vnq


View Profile

Ignore
June 03, 2011, 06:49:19 AM
 #13

a bit off topic, but if this is the way your brain naturally wants to go, look into using LESS

http://lesscss.org/
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!