Solved

Apply 'float' to parent <div> tag

Posted on 2016-07-31
2
43 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Kill default webkit margin!  Please! 6 30
Error in script 11 55
Placeholder text not disappearing in Contact Form 7 2 14
Change of column alignment in div 2 18
"I want to put my photos online, but I don't want them stolen.  What settings should I use?" When You Put Photos Online First and foremost, any digital file published on the WWW can be copied, stored, modified, retransmitted, etc.  Remember Naps…
When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
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 …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

776 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