1. Floating layout 1. Let the fixed width div float first! Take it out of the document flow. .aside{ float: left; width: 200px; background-color: red; } .content{ margin-left: 200px; background-color: blue; } <div class="aside"> I have always been a very good person, and I have always been a very good person. I have always been a very good person, and I have always been a very good person. </div> <div class="content"> I have always been a very good person, and I have always been a very good person. I have always been a very good person, and I have always been a very good person. </div> 2. Negative value of margin (3 divs)
.aside{ float: left; margin-right: -200px; width: 200px; background-color: red; } .content{ float: right; } .content .inner{ margin-left: 200px; background-color: blue; } <div class="aside"> I have always been a very good person, and I have always been a very good person. I have always been a very good person, and I have always been a very good person. </div> <div class="content"> <div class="inner"> I am a very good person, and I am very happy with my work. I am very happy with my work. I am very happy with my work. I am very happy with my work. I am very happy with my work. I am very happy with my work. I am very happy with my work. </div> </div> 3.calc() calculation properties Note: When using calc to calculate properties, there must be spaces on both sides of the operator (- + etc.) Note that the two divs must float left and right. The width that must be subtracted from the calc width must be consistent with the fixed width. .aside{ float: left; width: 200px; } .content{ float: right; calc:(100% - 200px); } <div class="aside"> I have always been a very good person, and I have always been a very good person. I have always been a very good person, and I have always been a very good person. </div> <div class="content"> I have always been a very good person, and I have always been a very good person. I have always been a very good person, and I have always been a very good person. </div> 4.Flex layout
body{ display: flex; } .aside{ flex: 0 0 200px; background-color: red; } .content{ flex: 1; background-color:blue; } <div class="aside"> I have always thought that the world is full of energy, but I have always thought that the world is full of energy. I have always thought that the world is full of energy, but I have always thought that the world is full of energy! </div> <div class="content"> I am a very good person, very good at dealing with things. I am a very good person, very good at dealing with things, very good at being a good person, very good at being a good person. </div> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: JavaScript to achieve mouse drag effect
>>: 202 Free High Quality XHTML Templates (1)
introduction: There are a lot of information and ...
1. First create the file (cd to the directory whe...
What is ORM? ORM stands for Object Relational Map...
The ogg process of a database produced some time ...
history route History mode refers to the mode of ...
rep / egrep Syntax: grep [-cinvABC] 'word'...
Mini Program Data Cache Related Knowledge Data ca...
1. Complex SQL queries 1.1. Single table query (1...
When implementing this function, the method I bor...
Problem description: I used a desktop computer an...
1. Add alternative text to your logo This has two...
Preface: Use watermark effect in vue project, you...
This article example shares the specific code for...
CentOS6.9 installs Mysql5.7 for your reference, t...
Overview There are many form requirements in the ...