Vertical Align With CSS

Tags

, , , , ,

I have been looking for a way to vertical align content and text to the middle of the parent element(for example).

Most solutions found implied that I should make use of the flex property or vertical-align properties. It takes a couple of lines of code and the last named property would not function while taking use of divs. Also there were a couple of answers that suggested use of the position property.

So my solution is simply to use the property padding.

padding-top: 10px;

This should push the content in which the property is used within(as for example a div) with 10 pixels from the top of the parent element.

In case you wish to push it down more than that, try changing the number to a greater one. Or the other way around. The property can also use:

padding-bottom: 10px;

This will “push” content 10 pixels above the bottom of the element. Of course you could even use:

padding-left: 10px;
padding-right: 10px;

That will move the content 10 pixels from the left and 10 pixels from the right.

Advertisements

Listing Folders (PHP)

Tags

, , , ,

<?php

$directory = "test/";

$files = glob($directory. "*");
//$pos = strpos($files, "/");
//$test = substr($files, $pos));

foreach($files as $file)
{
if(is_dir($file))
{
$pos = strpos($file, "/");
$test = substr($file, $pos + 1);
echo "$test";
echo "
";
}

}

?>

Sharepoint Development With HTML,CSS And XSL

We have just in our class, started to work with CSS, HTML and XSL in Sharepoint, in order to customize web parts to the design we want the site to look like. Here is the XSL code, written in Sharepoint Designer:

sdxsl

As you can see, the code is written in xsl, with a touch of html, which is the way themes and design should be built in Sharepoint.

Here is the CSS file for the page:
css

And here is the result:

sharepoint

As you can see, there you have the result. A nice design that shows picture to the left and the author’s name and the title to the right. I have been using table and table cells, as I am yet to learn about floating <div>s.

How To Find Out If It’s A String Or An Int As A Textbox Value

When you use the textbox from a html file in Javascript, the value will always return a string.

So that made me curious to try if there is any way that I could think of that would return either string if there are non numeric characters or int if there are only numeric ones.
Here is the HTML file:
intaltstringhtml

So the value comes from the input text called “myTextRuta”, which is Swedish for “myTextBox”.
After almoust one hour and a half of tweaking, I’ve wrote the following script, which works:

intaltstringfrantextruta

 

If you test the files, you will see that it works, which it feels like a big step for me into becoming a top programmer.

stringfrantextruta

As you can see, a bunch of letters gives the result “string”.

 

intfrantextruta

A bunch of numbers gives the result “int”.

UPDATE:
I’ve come out with a better solution, one tht is more logic to me at lines 16 to 24. Here is the code:
if(test != “” && isNaN(test))
{
typeof test == “string”;
}
else if(test != “” && !isNaN(test))
{
var test = parseInt(test);
typeof test == “int”;
}

My Fourth Badge From CODECADEMY.COM: ‘BUILD “ROCK, PAPER, SCISSORS”‘

Tags

, , , , , , , , , ,

badge4fullscreen

Codecademy.com is the perfect place to getting started with projects and learning to code. Right now I am learning java script and this “badge”that you see it’s given because I have completed building the game ‘Rock, paper scissors’. It wasn’t hard but I had to think at certain times and look up on their forums for the answers.
You can find their forums at discuss.codecademy.com

Start Learning Programming And Code On Your Mobile Device

If you want to learn and code on the go, on your mobile device, then I got some news for you.

A friend of mine tipsed me about learning-to-code apps that are available for both Android and iOS.

Their developer is <em><b>Sololearn Inc</b></em> and the apps are to learn Javascript, Java, C++,C#, HTML,CSS,Python, PHP and SQL; they are called “Learn”+ programming language.

And as I mentioned, the apps are available for both iOS and Android. Good luck!