MyBB Community Forums

Full Version: [MyCode] Contain, an green box for your content
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
NOTE! This is my first MyCode ever, it might not be the best, but it's something.

MyCode Configuration

Title:
Contain
Short Description:
Creates a green box for nice formating.
Regular Expression:
\[contain\](.*?)\[/contain\]
Replacement:
<p class="contain">$1</p>
Global.css addition:
p.contain {
	text-align: center;
	padding: 1%;
	color: white; 
	background-color: #009900; /* For browsers that do not support gradients */    
	background: -webkit-linear-gradient(left top, #00e600, #00cc00, #00b300, #009900, #008000); /* For Safari 5.1 to 6.0 */
	background: -o-linear-gradient(bottom right, #00e600, #00cc00, #00b300, #009900, #008000); /* For Opera 11.1 to 12.0 */
	background: -moz-linear-gradient(bottom right, #00e600, #00cc00, #00b300, #009900, #008000); /* For Firefox 3.6 to 15 */
	background: linear-gradient(to bottom right, #00e600, #00cc00, #00b300, #009900, #008000); /* Standard syntax */
}

You're done, the result should be something like this;
[Image: mcode1.png]To be added:
 Option to format text-align (example: [contain="align-left"]
 Darker/lighter gradients
 Different side gradient (up-down, diagonal, rounded, etc)
Style elements really belong in the head, not the body. I'm not sure how many browsers will work correctly; you should inline it, or move the definition to your global.css
(2016-02-10, 11:33 PM)laie_techie Wrote: [ -> ]Style elements really belong in the head, not the body. I'm not sure how many browsers will work correctly; you should inline it, or move the definition to your global.css

You mean add the class for p used to global.css?
I'll try and update it as soon as possible.
What laie_techie means by inline, you would add it to your replacement. For example:
<p style="text-align: center;">$1</p>

Of course adding the other CSS elements.
(2016-02-11, 07:15 PM)nth Wrote: [ -> ]What laie_techie means by inline, you would add it to your replacement. For example:
<p style="text-align: center;">$1</p>

Of course adding the other CSS elements.

Ah, he did mention something about "global.css".. so I got bit confused there, I'm still learning CSS/HTML, thanks for explaining.
I'll try update it to inline.