?
Solved

Apply 'float' to parent <div> tag

Posted on 2016-07-31
2
Medium Priority
?
53 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
Suggested Courses

719 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