How to programming website with php in a modularized way? I am developing a website that many pages share the same header/footer/sidebar/topbar. 
Say I have three pages: one/index.php, second/index.php, third/index.php. They all share the same header/footer/sidebar.
The problem is where should I put the header/etc and its corresponding css file, since a piece of html code could not import css file. 
What's a good way to modularize php/html page? Is there any good tutorial?

Sounds like you may want a MVC framework and a template engine. Check out CodeIgniter, or TinyMVC with Smarty. Call external stylesheets with:
    <LINK href="special.css" rel="stylesheet" type="text/css">


You can use the PHP include statement to insert your header/footer/sidebar files where they need to be inserted in your other PHP pages.