Lecture
The best way to learn CSS — like so much else — is to start practicing right away. Unlike XHTML and PHP, you do not need to work with the central template files. Also, there is no basic concept to understand. Just try it! Favorite trial and error also works here.
Before you begin, there should already be some information in your style.css file. Let's find out right now what it means.
one 2 3 four five 6 7 eight | /* Theme Name: Тестовая тема Theme URI: http://wp-config.ru/ Description: Тестовая тема учебного курса. Version: 1.0 Author: wp-admin Author URI: http://wp-config.ru/ */ |
Here is the processed information about the topic:
At this stage, you need all the browsers that you want your theme to display correctly: Mozilla Firefox , Internet Explorer (ideally versions 6, 7 and 8), Opera , Google Chrome and Safari - all to test the theme under them. Different browsers sometimes perceive CSS differently. It is best to test the theme in as many operating systems and browsers as possible. If you are as lazy as I am - test the theme only in Firefox :-)
Open the style.css file in the editor and paste the following code there:
one 2 3 four five 6 7 eight 9 | body { margin : 0 ; font-family : Arial , Helvetica , Georgia, Sans-serif ; font-size : 12px ; text-align : left ; vertical-align : top ; background : #ffffff ; color : #000000 ; } |
As with XHTML or PHP, add padding to organize code:
Save the style.css file, refresh the browsers to see the changes (remember that you work with several browsers).
Consider that body {} is a tag, and everything between curly braces is attributes and values, as in XHTML. { - this is open. } Is to close. Inside curly brackets { and }, a colon means the beginning of a value , and a semicolon - the end (I use terms from XHTML and PHP "tag", "attribute", "value" for CSS, so that it is easier for you; in fact, PHP and CSS uses different terms, for example: parameters, selector and property).
Before proceeding, I will explain why you used the body selector {} - because you are working on styling the base part of the web page - with the < body> tag . You do not stylize the <header> tag, because there is nothing to stylize. All that is displayed on the web page is in the structure of the < body> and </ body> tags.
Later you will work on the DIV style of the block with the ID “header” and each block for which you will need to specify your own style, which is the most common one.
Let's take a closer look at our code :
margin: 0; - cancellation of the default indentation inside the body tag. If you want the indents to be present, or even make them bigger, change 0 to a larger value: 10px, 13px, 20px, etc. PX is abbreviated pixel. When the field is "0", you do not need to put px after zero.
In the image below, red is the default indent applied to the body tag:
After changing the indent to margin: 0; indents will disappear.
font- family: Verdana, Helvetica, Georgia, Sans- serif; - indicates which font to use to display the item. The fonts that follow after the first, in this case Verdana , are alternative. If the visitors of your page do not have the Verdana font installed on their system, the browser will search for the font Helvetica , then Georgia , then Sans- serif . You can find a list of installed fonts in the system fonts folder of your operating system;
font- size: 12 px; - font size, here everything speaks for itself. Increase or decrease to see changes;
text- align: left; - aligns your text to the left, change it to align to “right” or “justify” to see the changes;
vertical- align: top; - Checks whether everything starts from the top of the page. If you change this item to align to the middle or bottom edge, the contents will go down;
background: # ffffff; means white background. The color has its own code in HTML. For example, #ffffff is a white code. # 000000 is the black code.
color: # 000000; means the text will be black.
In our course, we will learn the basics of CSS at a sufficient level so that you can create a simple WordPress theme. If you want to go further and learn more about CSS, you can do it yourself, outside of our course, this tutorial or this tutorial will help you learn it.
Comments
To leave a comment
Content Management Systems (CMS)
Terms: Content Management Systems (CMS)