The questions encountered in Baidu interviews need to achieve the following layout effects The size of the purple column in the middle will widen/narrow with the amount of fonts, and the extra text will be automatically omitted as [...]. The green column on the right should be closely connected to the purple column. The main operations for the purple column are: 1.flex: 0 1 auto (adaptive) 2.text-overflow:ellipsis; (automatically omit text) overflow:hidden; white-space: nowrap; The complete code is as follows // CSS part.container { display: flex; } .pic { width: 100px; height: 100px; border-radius: 50%; background-color: pink; } .name { flex:0 1 auto; height: 100px; background-color: purple; text-overflow:ellipsis; overflow:hidden; white-space: nowrap; } .tag { width: 100px; height: 100px; text-align: center; line-height: 100px; background-color: seagreen; } // HTML part <div class="container"> <div class="pic"></div> <div class="name"> zhasansndfdkfnald </div> <div class="tag">Designer</div> </div> Summarize This concludes this article about how to use CSS to implement a three-column layout with the middle column adaptive and changing width with text size. For more relevant CSS three-column layout content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! |
<<: Util module in node.js tutorial example detailed explanation
>>: Use iframe to submit form without refreshing the page
Syntax composition: 1 Annotation information 2 Co...
Install MySQL under Windows for your reference. T...
1. Download, install and configure mysql-8.0.15 1...
describe When calling this interface, you need to...
Ubuntu 16.04 builds FTP server Install ftp Instal...
question In LINUX, periodic tasks are usually han...
The usage format of the mysqladmin tool is: mysql...
Part 1 HTML <html> -- start tag <head>...
Table of contents Achieve results Rolling load kn...
Abstract: Many companies, even most companies whos...
1. Installation steps for MySQL 8.0.12 version. 1...
If there are files that are being used by a proce...
The DATE_ADD() function adds a specified time int...
Copy code The code is as follows: html, address, ...
Introduction: In many cases, many people think th...