<span id="bv9zh"><optgroup id="bv9zh"></optgroup></span>
    標(biāo)簽下,然后為div指定一個(gè)類, 然后CSS這樣設(shè)計(jì): #container{ min-width: 600px; width:expression(document.body.clientWidth < 600? \"600px\": \"auto\" );} 第一個(gè)min-width是正常的;但第2行的width使用了Javascript,這只有IE才認(rèn)得,這也會(huì)讓你的HTML文檔不太正規(guī)。它實(shí)際上通 過Javascript的判斷來實(shí)現(xiàn)最小寬度。

    6.DIV浮動(dòng)IE文本產(chǎn)生3象素的bug 左邊對象浮動(dòng),右邊采用外補(bǔ)丁的左邊距來定位,右邊對象內(nèi)的文本會(huì)離左邊有3px的間距. #box{ float:left; width:800px;} #left{ float:left; width:50%;} #right{ width:50%;} *html #left{ margin-right:-3px; \/\/這句是關(guān)鍵}
    <\/div>
    <\/div> <\/div>

    7.IE捉迷藏的問題 當(dāng)div應(yīng)用復(fù)雜的時(shí)候每個(gè)欄中又有一些鏈接,DIV等這個(gè)時(shí)候容易發(fā)生捉迷藏的問題。 有些內(nèi)容顯示不出來,當(dāng)鼠標(biāo)選擇這個(gè)區(qū)域是發(fā)現(xiàn)內(nèi)容確實(shí)在頁面。 解決辦法:對#layout使用line-height屬性或者給#layout使用固定高和寬。頁面結(jié)構(gòu)盡量簡單。

    8.float的div閉合;清除浮動(dòng);自適應(yīng)高度;

    ① 例如:<#div id=”floatA” ><#div id=”floatB” ><#div id=” NOTfloatC” >這里的NOTfloatC并不希望繼續(xù)平移,而是希望往下排。(其中floatA、floatB的屬性已經(jīng)設(shè)置為 float:left;) 這段代碼在IE中毫無問題,問題出在FF。原因是NOTfloatC并非float標(biāo)簽,必須將float標(biāo)簽閉合。在 <#div class=”floatB”> <#div class=”NOTfloatC”>之間加上 < #div class=”clear”>這個(gè)div一定要注意位置,而且必須與兩個(gè)具有float屬性的div同級,之間不能存在嵌套關(guān)系,否則會(huì)產(chǎn)生異常。 并且將clear這種樣式定義為為如下即可: .clear{ clear:both;}

    ②作為外部 wrapper 的 div 不要定死高度,為了讓高度能自動(dòng)適應(yīng),要在wrapper里面加上overflow:hidden; 當(dāng)包含float的 box的時(shí)候,高度自動(dòng)適應(yīng)在IE下無效,這時(shí)候應(yīng)該觸發(fā)IE的layout私有屬性(萬惡的IE??!)用zoom:1;可以做到,這樣就達(dá)到了兼容。 例如某一個(gè)wrapper如下定義: .colwrapper{ overflow:hidden; zoom:1; margin:5px auto;}

    ③對于排版,我們用得最多的css描述可能就是float:left.有的時(shí)候我們需要在n欄的float div后面做一個(gè)統(tǒng)一的背景,譬如:
    <\/div>
    <\/div>
    <\/div> <\/div> 比如我們要將page的背景設(shè)置成藍(lán)色,以達(dá)到所有三欄的背景顏色是藍(lán)色的目的,但是我們會(huì)發(fā)現(xiàn)隨著left center right的向下拉長,而 page居然保存高度不變,問題來了,原因在于page不是float屬性,而我們的page由于要居中,不能設(shè)置成float,所以我們應(yīng)該這樣解決
    <\/div>
    <\/div>
    <\/div> <\/div> <\/div> 再嵌入一個(gè)float left而寬度是100%的DIV解決之

    ④萬能float 閉合(非常重要!) 關(guān)于 clear float 的原理可參見 [How To Clear Floats Without Structural Markup],將以下代碼加入Global CSS 中,給需要閉合的div加上 class=\"clearfix\" 即可,屢試不爽. \/* Clear Fix *\/ .clearfix:after { content:\".\"; display:block; height:0; clear:both; visibility:hidden; } .clearfix { display:inline-block; } \/* Hide from IE Mac *\/ .clearfix {display:block;} \/* End hide from IE Mac *\/ \/* end of clearfix *\/ 或者這樣設(shè)置:.hackbox{ display:table; \/\/將對象作為塊元素級的表格顯示}

    11.高度不適應(yīng) 高度不適應(yīng)是當(dāng)內(nèi)層對象的高度發(fā)生變化時(shí)外層高度不能自動(dòng)進(jìn)行調(diào)節(jié),特別是當(dāng)內(nèi)層對象使用margin 或paddign 時(shí)。 例: #box {background-color:#eee; } #box p {margin-top: 20px;margin-bottom: 20px; text-align:center; }

    p對象中的內(nèi)容<\/p> <\/div> Solution: Add two empty div objects above and below the P object. CSS code: .1{height:0px;overflow:hidden;} or add a border attribute to the DIV.

    12. Why is there a gap under the image under IE6? There are many ways to solve this bug. You can change the layout of the html, or set the img to display:block or set the vertical-align attribute to vertical-align:top. | bottom |middle |text-bottom can be solved.

    13. How to align text and text input box with vertical-align:middle;

    14. There is a difference between id and class defined in web standards What's the difference? 1. Repeating IDs is not allowed in web standards. For example, div id="aa" is not allowed to be repeated twice, and class defines a class, which can theoretically be repeated infinitely, so definitions that need to be referenced multiple times can be Use him. 2. The priority of attributes. The priority of ID is higher than that of class. See Example 3 above. It is convenient for client scripts such as JS. If you want to perform script operations on an object in the page, you can define it for it. An ID, otherwise you can only find it by traversing the page elements and specifying specific attributes. This is a relative waste of time and resources, and is far less simple than an ID.

    15. After the content in LI exceeds the length, use an ellipsis Display method This method is applicable to IE and OP browsers

    16. Why can’t IE set the scroll bar color in web standards? The solution is to replace the body with html

    17. Why can't I define a container with a height of about 1px? This problem under IE6 is caused by the default line height. There are many solutions, such as: overflow: hidden | zoom:0.08 | line-height:1px

    18. How to make the layer display on top of FLASH? The solution is to set transparent for FLASH

    19. How to vertically center a layer in the browser. Here we use percentage absolute positioning, and the method of patching negative values ??outside. The size of the negative value is its own width and height divided by two< ;style type="text/css">

    FF and IE

    1. Div centering problem. The div is already centered when margin-left and margin-right are set to auto. IE No, IE needs to set the body to be centered. First define text-algin: center in the parent element; this means that the content within the parent element is centered.

    2. The border and background of the link (a tag). To add a border and background color to the a link, you need to set display: block and float: left to ensure no line breaks. Referring to menubar, setting the height of a and menubar is to avoid dislocation of the bottom edge display. If height is not set, a space can be inserted in menubar.

    3. The problem that the hover style does not appear after the hyperlink is visited. The hyperlink style that is clicked and visited no longer has hover and active. Many people should have encountered this problem. The solution is to change the CSS properties. Sorting order: L-V-H-A Code:

    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    /* intLen){ strTemp+=strContent.substr(0,intLen)+" "; strContent=strContent.substr(intLen,strContent.length); } strTemp+=" "+strContent; obj.innerHTML=strTemp; } if(document.getElementById && !document.all) toBreakWord("ff", 37); /* ]]> */

    13.為什么IE6下容器的寬度和FF解釋不同呢
    讓FireFox與IE兼容
    The difference in the problem is whether the overall width of the container includes the width of the border. Here IE6 interprets it as 200PX, while FF interprets it as 220PX. So what exactly causes the problem? If you remove the xml at the top of the container, you will find that the original problem lies here. The statement at the top triggers IE's qurks mode. For relevant knowledge about qurks mode and standards mode, please refer to: http://www.microsoft.com/china /msdn/library/webservices/asp.net/ ASPNETusStan.mspx?mfr=true

    IE6, IE7, FF IE7.0 is out, and there are new problems with CSS support. There are more browsers, and the compatibility of web pages is getting worse. We are still struggling. In order to solve the compatibility problem of IE7.0, I found the following article: Now I mostly use !important to hack, for ie6 and firefox The test can be displayed normally, but ie7 can correctly interpret !important, which will cause the page not to be displayed as required! The following is a compatibility collection of three browsers.

    The first is the CSS HACK method height:20px; /*For Firefox*/ *height:25px; /*For IE7 & IE6*/ _height :20px; /*For IE6*/ Pay attention to the order. This is also a CSS HACK, but it is not as simple as the above. #example { color: #333; } /* Moz */ * html #example { color: #666; } /* IE6 */ * html #example { color: #999; } /* IE7 */

    < !--[if lte IE 6]>

    The third method is the css filter method. The following is a classic translation from a foreign website. . Create a new css style as follows: #item { width: 200px; height: 200px; background: red; } Create a new div and use the previously defined css style:
    some text here< /div> Add the lang attribute here in the body expression, the Chinese is zh: Now define a style for the div element: *:lang(en) #item{ background:green !important; } This is done to overwrite the original css style with !important. Since the :lang selector is not supported by IE7.0, it will not have any effect on this sentence. Therefore, the same effect under IE6.0 is achieved, but it is very difficult. Unfortunately, Safari also does not support this attribute, so you need to add the following CSS style: #item:empty { background: green !important } : The empty selector is a CSS3 specification. Although Safari does not support this specification, it will still be used. Selecting this element, regardless of whether this element exists, will now be green on all browsers except IE. For compatibility with IE6 and FF, you can consider the previous !important. Personally, I prefer to use




    ------------------- ----------------------------------
    Reprinted from: http://68design.net/Web-Guide/ HTMLCSS/37154-1.html

    Statement of this Website
    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

    Hot AI Tools

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Hot Topics

    PHP Tutorial
    1502
    276
    Implementing Clickable Buttons Using the HTML button Element Implementing Clickable Buttons Using the HTML button Element Jul 07, 2025 am 02:31 AM

    To use HTML button elements to achieve clickable buttons, you must first master its basic usage and common precautions. 1. Create buttons with tags and define behaviors through type attributes (such as button, submit, reset), which is submitted by default; 2. Add interactive functions through JavaScript, which can be written inline or bind event listeners through ID to improve maintenance; 3. Use CSS to customize styles, including background color, border, rounded corners and hover/active status effects to enhance user experience; 4. Pay attention to common problems: make sure that the disabled attribute is not enabled, JS events are correctly bound, layout occlusion, and use the help of developer tools to troubleshoot exceptions. Master this

    Configuring Document Metadata Within the HTML head Element Configuring Document Metadata Within the HTML head Element Jul 09, 2025 am 02:30 AM

    Metadata in HTMLhead is crucial for SEO, social sharing, and browser behavior. 1. Set the page title and description, use and keep it concise and unique; 2. Add OpenGraph and Twitter card information to optimize social sharing effects, pay attention to the image size and use debugging tools to test; 3. Define the character set and viewport settings to ensure multi-language support is adapted to the mobile terminal; 4. Optional tags such as author copyright, robots control and canonical prevent duplicate content should also be configured reasonably.

    Best HTML tutorial for beginners in 2025 Best HTML tutorial for beginners in 2025 Jul 08, 2025 am 12:25 AM

    TolearnHTMLin2025,chooseatutorialthatbalanceshands-onpracticewithmodernstandardsandintegratesCSSandJavaScriptbasics.1.Prioritizehands-onlearningwithstep-by-stepprojectslikebuildingapersonalprofileorbloglayout.2.EnsureitcoversmodernHTMLelementssuchas,

    HTML for email templates tutorial HTML for email templates tutorial Jul 10, 2025 pm 02:01 PM

    How to make HTML mail templates with good compatibility? First, you need to build a structure with tables to avoid using div flex or grid layout; secondly, all styles must be inlined and cannot rely on external CSS; then the picture should be added with alt description and use a public URL, and the buttons should be simulated with a table or td with background color; finally, you must test and adjust the details on multiple clients.

    How to associate captions with images or media using the html figure and figcaption elements? How to associate captions with images or media using the html figure and figcaption elements? Jul 07, 2025 am 02:30 AM

    Using HTML sums allows for intuitive and semantic clarity to add caption text to images or media. 1. Used to wrap independent media content, such as pictures, videos or code blocks; 2. It is placed as its explanatory text, and can be located above or below the media; 3. They not only improve the clarity of the page structure, but also enhance accessibility and SEO effect; 4. When using it, you should pay attention to avoid abuse, and apply to content that needs to be emphasized and accompanied by description, rather than ordinary decorative pictures; 5. The alt attribute that cannot be ignored, which is different from figcaption; 6. The figcaption is flexible and can be placed at the top or bottom of the figure as needed. Using these two tags correctly helps to build semantic and easy to understand web content.

    How to handle forms submission in HTML without a server? How to handle forms submission in HTML without a server? Jul 09, 2025 am 01:14 AM

    When there is no backend server, HTML form submission can still be processed through front-end technology or third-party services. Specific methods include: 1. Use JavaScript to intercept form submissions to achieve input verification and user feedback, but the data will not be persisted; 2. Use third-party serverless form services such as Formspree to collect data and provide email notification and redirection functions; 3. Use localStorage to store temporary client data, which is suitable for saving user preferences or managing single-page application status, but is not suitable for long-term storage of sensitive information.

    What are the most commonly used global attributes in html? What are the most commonly used global attributes in html? Jul 10, 2025 am 10:58 AM

    class, id, style, data-, and title are the most commonly used global attributes in HTML. class is used to specify one or more class names to facilitate style setting and JavaScript operations; id provides unique identifiers for elements, suitable for anchor jumps and JavaScript control; style allows for inline styles to be added, suitable for temporary debugging but not recommended for large-scale use; data-properties are used to store custom data, which is convenient for front-end and back-end interaction; title is used to add mouseover prompts, but its style and behavior are limited by the browser. Reasonable selection of these attributes can improve development efficiency and user experience.

    Implementing Native Lazy Loading for Images in HTML Implementing Native Lazy Loading for Images in HTML Jul 12, 2025 am 12:48 AM

    Native lazy loading is a built-in browser function that enables lazy loading of pictures by adding loading="lazy" attribute to the tag. 1. It does not require JavaScript or third-party libraries, and is used directly in HTML; 2. It is suitable for pictures that are not displayed on the first screen below the page, picture gallery scrolling add-ons and large picture resources; 3. It is not suitable for pictures with first screen or display:none; 4. When using it, a suitable placeholder should be set to avoid layout jitter; 5. It should optimize responsive image loading in combination with srcset and sizes attributes; 6. Compatibility issues need to be considered. Some old browsers do not support it. They can be used through feature detection and combined with JavaScript solutions.

    See all articles