Solved

Apply 'float' to parent <div> tag

Posted on 2016-07-31
2
38 Views
Last Modified: 2016-07-31
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
Comment
Question by:MOSTAGHASSI
2 Comments
 
LVL 17

Accepted Solution

by:
bigeven2002 earned 500 total points
ID: 41736754
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
 

Author Comment

by:MOSTAGHASSI
ID: 41736983
thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now