Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Apply 'float' to parent <div> tag

Posted on 2016-07-31
2
Medium Priority
?
56 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 2000 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

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…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Suggested Courses

916 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