For the fixed width of non-floating elements we can use margin:0 auto; To center horizontally, we also have a common technique to solve the problem of horizontal centering for variable-width floating elements. The decomposition is as follows:1. HTML part: class="box">I was floating I am also the center 2. CSS part:. box{Float:Left position:relative; left: " P{ float:left; position: right:
@media is a new definition in CSS3, the function is very powerful, as the name implies that the PC is unable to match the screen, so orientation only for mobile devices.1. Head declarationCopy CodeThe code is as follows:Added toCopy CodeThe code is as follows:2. Media Match screen is horizontal screen or vertical screenCopy CodeThe code is as follows:@media all and (Orientation:landscape) {Body {}}@media all and (orientation:portrait) {Body {Backgroun
This article mainly for you to share the CSS vertical horizontal center of the 5 best solutions and their respective advantages and disadvantages, the introduction of very detailed, with reference value, need to refer to the friend, hope to help everyone.
CSS Center Alignment
The browser prefix is omitted from the code
The following examples are sorted
to tags in HTML:
We added a new id named current to the first a tag. Let's continue to read the CSS section and design the color for the current ID first:
# Nav Li a # current {background-color: # 2788da; color: # FFF ;}
Preview the result. The background color of the homepage has become blue.[Ctrl + A select all Note: If you need to introduce external JS, You need to refresh it to execute]
Continue to improve our navigation, and add a
Source: http://www.imooc.com/code/6364In addition to inserting the table label in the previous section, you can center the indeterminate block horizontally, this section describes the 2 ways to achieve this effect, changing the display type of the element to be the inline element, and using its properties to set directly. The second method: Change the display of the block-level element to the inline type (set to the inline element display), then use text-align:center to achieve the centering eff
This article describes the JQUERY+CSS implementation of the red Line horizontal level two menu effect. Share to everyone for your reference. Specifically as follows:
This is a navigation with the menu, which is currently a menu, will be very personalized display, the mouse will be displayed after the menu gap, very interesting bar, I hope you like.
The screenshot of the running effect is as follows:
Th
css| Application Example
How do I use CSS to turn horizontal lines into dashes?
One answer: The following is a quote fragment:
Run code Copy Code Save Code
Answer two:The following is a reference fragment:
The example of this article describes the horizontal layout multilevel Web Menu effect implemented by JQUERY+CSS. Share to everyone for your reference. Specifically as follows:
Here is a demo of jquery and CSS common Web pages Common navigation menu, support Level two form, blue style, support up to two levels, three level may be to the code to be reformed. This
I am not a professional front end, so toss long time AH QaqThe requirement is two div, the inner Div does not wrap and the outer div shows the horizontal scroll bar when it is out.This is similar to the following:The first code is as follows:CSS style:. nowrap{White-space:nowrap;Overflow-x:Scroll;Height:200px;}. Item-t{Display:inline;float: Left;width:108px;Height:200px;background:Yellow;vertical-align:Top;}. Item-t+.item-t{Margin-left:15px;}This is c
This article mainly introduces how to use pure CSS to implement table fixed column and table header, the middle horizontal scrolling related data, the text through the example code in detail to introduce to you about the realization of this effect of ideas and methods, to everyone's study or work has a certain reference learning value, The friends who need to take a look below.
Objective
Recently in the ba
In div + css, the width is not clear and the horizontal center is set to text-align: center and margin: 0 auto; but the horizontal center is still not allowed,
The overall width is unknown, there is a background, and the background can be extended.
Urgent! Urgent! Urgent! Urgent!
Reply to discussion (solution)
Paste the page code
If the wid
Page horizontal center is a headache, especially for beginners. Incompatibility between browsers can also cause great problems. The following describes common horizontal page center methods.
For the following content, see "proficient in CSS".
Html
Code:
Copy codeThe Code is as follows: IE Center Method:
Body {
Text-align: center;
Min-width: 760px;
}
# Wr
method One: use absolute positioningWe all know margin:0 auto, can achieve the horizontal center, but do not know margin:0 auto, but also can achieve vertical center;Add the following style to the center element:{ border:2px solid red; height: 200px; margin: auto; position: absolute; top: 0; Left: 0; Bottom: 0; Right: 0; }Disadvantage: Content is easy to overflow, recommended use Overflow:auto;method Two: nega
This article brings to you the content is about the CSS to achieve horizontal navigation and vertical navigation bar Method (code), there is a certain reference value, the need for friends can refer to, I hope to help you.
First, vertical navigation
Operation Result:
Second, horizontal navigation:
Operation Result:
Attention:
1. The display=block of a tag le
This article mainly introduces jquery + css to implement the gorgeous horizontal level-2 drop-down menu-with source code download. If you need it, refer to the following:
View results source code download
Html code:
The Code is as follows:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.