[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 58
  • Last Modified:

Apply 'float' to parent <div> tag

Hi;

<div class="basicdiv3rows">
  <div class="row1">art</div>
  <div class="row2-horizontallinemain-artandculture"></div>
  <div class="row3">life</div>
</div>

Open in new window


Please let me know that apply 'float' to parent cause apply to children also?
0
MOSTAGHASSI
Asked:
MOSTAGHASSI
1 Solution
 
bigeven2002Commented:
Hello,

Yes, the parent element is inherited by the child element so the nested DIVs will also float right.  In the CSS, a clear float DIV should follow the closing tag of the parent DIV.

CSS
.basicdiv3rows {
  float:right;
}
.clearfloat {
  clear:both;
}

Open in new window


HTML
<div class="basicdiv3rows">
  <div class="row1">art</div>
  <div class="row2-horizontallinemain-artandculture">culture</div>
  <div class="row3">life</div>
</div>
<!-- remove or comment out line below if you do not want a line break after the floated divs -->
<div class="clearfloat"></div>
<div>
Next line
</div>

Open in new window


Here is an example from the code above:
https://jsfiddle.net/kc3m0pjh/5/
0
 
MOSTAGHASSIAuthor Commented:
thanks
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now