If you want to locate 30 points from the left and 5 points from the top, what can you do? BR>
#navigation
{
position: absolute;
left: 30px;
top: 5px
}
Of course, you can also do this:
margin: 5px 0 0 30px
Note that the order of the 4 numbers is: up, right, down, left. Of course, sometimes positioning rather than margins is better.
10. Background color straight to the bottom of the screen
Control in the vertical direction is beyond the capabilities of CSS. If you want the navigation bar to go straight to the bottom of the page like the content bar, using a table is very convenient, but if you only use CSS like this:
#navigation
{
background: blue;
width: 150px
}
A shorter navigation bar will not go straight to the bottom, it will end when the content ends halfway. What to do?
Unfortunately, the only way to cheat is to add a background image to the shorter column, with the same width as the column width, and make it the same color as the set background color.
body
{
background: url(blue-image.gif) 0 0 repeat-y
}
You cannot use em as the unit at this time, because then the trick will be revealed once the reader changes the font size, and you can only use px.
11. Comparison between Block and inline elements
All HTML elements are either block or inline. The characteristics of the block element are:
Always start on a new line;
Height, line height and top and bottom margins can all be controlled;
The width defaults to 100% of its container unless a width is set
,
,
,
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
In this week's roundup: Firefox gains locksmith-like powers, Samsung's Galaxy Store starts supporting Progressive Web Apps, CSS Subgrid is shipping in Firefox
In this week's roundup: Internet Explorer finds its way into Edge, Google Search Console touts a new speed report, and Firefox gives Facebook's notification
You’re probably already at least a little familiar with CSS variables. If not, here’s a two-second overview: they are really called custom properties, you set
Here's what I'd like you to know upfront: this is a hard problem. If you've landed here because you're hoping to be pointed at a tool you can run that tells
Picture-in-Picture made its first appearance on the web in the Safari browser with the release of macOS Sierra in 2016. It made it possible for a user to pop
I learned something about percentage-based (%) padding today that I had totally wrong in my head! I always thought that percentage padding was based on the
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.