Home  >  Article  >  Web Front-end  >  How to set css a without line breaks

How to set css a without line breaks

藏色散人
藏色散人Original
2021-04-26 09:38:422974browse

css How to set a without line breaks: first create a new html file and use the a tag to create a link; then add an id attribute to the a tag; then set the style of the a tag through id; finally add white- Set the space attribute to nowrap to force the text to not wrap.

How to set css a without line breaks

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

Create a new html file, named test.html, to explain how to use CSS to limit the text of A link to force it not to wrap.

How to set css a without line breaks

In the test.html file, use the a tag to create a link for testing.

How to set css a without line breaks

In the test.html file, add an id attribute to the a tag for the following style definition.

How to set css a without line breaks

##In the test.html file, write the tag. The css style of the page will be written in this within the label.

How to set css a without line breaks

In the css tag, set the style of the a tag through the id, define the float to the left, the width is 50px, the background color is gray, and the white-space attribute is set to nowrap implements forced non-line wrapping of text. Even if the width is defined, it will still be displayed due to the forced non-line wrapping.

How to set css a without line breaks

Open the test.html file in the browser to check the effect.

How to set css a without line breaks

[Recommended learning:

css video tutorial]

The above is the detailed content of How to set css a without line breaks. For more information, please follow other related articles on the PHP Chinese website!

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
Previous article:How to modify css styleNext article:How to modify css style