search
HomeWeb Front-endHTML Tutorialul li设置横排,并除去li前的圆点_html/css_WEB-ITnose

效果预览:http://hovertree.com/texiao/css/

如何用CSS制作横向菜单 让ul li横向排列及圆点处理 

我们先建立一个无序列表,来建立菜单的结构。代码是:

<ul><li><a href="http://hovertree.com/">首页</a></li><li><a href="http://hovertree.com/map/">网站地图</a></li><li><a href="http://hovertree.com/menu/hovertreecms/">HoverTreeCMS</a></li><li><a href="http://hovertree.com/menu/texiao/">特效</a></li><li><a href="http://cms.hovertree.com/">CMS在线预览</a></li><li><a href="http://hovertree.com/hvtart/bjae/74cc61ed089a2991.htm">jQuery图片列表鼠标经过遮罩显示文字</a></li><li><a href="http://hovertree.com/hvtart/bjae/rtmloulp.htm">原文</a></li></ul>

效果是:

  • 首页
  • 网站地图
  • HoverTreeCMS
  • 特效
  • CMS在线预览
  • jQuery图片列表鼠标经过遮罩显示文字
  • 原文
  • 第二步:隐藏li的默认样式,去掉圆点
    因为看起来不是很好看,菜单通常都不需要li默认的圆点,我们给UL定义一个样式来消除这些圆点。

    当然,为了更好的控制整个菜单,我们把菜单放在一个div里。页面代码变成:

    <ul><li><a href="http://hovertree.com/">首页</a></li><li><a href="http://hovertree.com/map/">网站地图</a></li><li><a href="http://hovertree.com/menu/hovertreecms/">HoverTreeCMS</a></li><li><a href="http://hovertree.com/menu/texiao/">特效</a></li><li><a href="http://cms.hovertree.com/">CMS在线预览</a></li><li><a href="http://hovertree.com/hvtart/bjae/74cc61ed089a2991.htm">jQuery图片列表鼠标经过遮罩显示文字</a></li><li><a href="http://hovertree.com/hvtart/bjae/rtmloulp.htm">原文</a></li></ul>

    CSS定义为:

    .hvtulli22 ul{list-style:none;} 
    说明:“.hvtulli22 ul”表示我要定义的样式将作用在hvtulli的层里的ul标签上。

    现在的效果是没有圆点了:

    首页

    网站地图

    HoverTreeCMS

    特效

    CMS在线预览

    jQuery图片列表鼠标经过遮罩显示文字

    原文

     

    第三步:关键的浮动
    这里是菜单变成横向的关键,我们给li元素加上一个“float:left;”属性,让每个li浮动在前面一个li的左面,margin-left:10px 使li之间间隔10像素。

    CSS定义为:

    .hvtulli li{float:left;margin-left:10px} 
    效果是:http://hovertree.com/texiao/css/

    看,菜单变横向了。就这么简单!下面需要做的就是优化细节了。

    HTML文件代码:

    ul中li横排,除去li前的圆点,li之间间隔-何问起

    何问起

    ul中li横排,除去li前的圆点,li之间间隔

    <ul><li><a href="http://hovertree.com/">首页</a></li><li><a href="http://hovertree.com/map/">网站地图</a></li><li><a href="http://hovertree.com/menu/hovertreecms/">HoverTreeCMS</a></li><li><a href="http://hovertree.com/menu/texiao/">特效</a></li><li><a href="http://cms.hovertree.com/">CMS在线预览</a></li><li><a href="http://hovertree.com/hvtart/bjae/74cc61ed089a2991.htm">jQuery图片列表鼠标经过遮罩显示文字</a></li><li><a href="http://hovertree.com/hvtart/bjae/rtmloulp.htm">原文</a></li></ul>

    js,jquery,css,html5特效 

    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
    The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

    The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

    HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

    The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

    The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

    The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

    HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

    The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

    HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

    HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

    HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

    HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

    From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

    HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

    Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

    WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

    See all articles

    Hot AI Tools

    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.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    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

    ZendStudio 13.5.1 Mac

    ZendStudio 13.5.1 Mac

    Powerful PHP integrated development environment

    mPDF

    mPDF

    mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

    Atom editor mac version download

    Atom editor mac version download

    The most popular open source editor

    VSCode Windows 64-bit Download

    VSCode Windows 64-bit Download

    A free and powerful IDE editor launched by Microsoft

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment