How to align two divs inline? - html

I have two divs 1)with the icon 2)with the text related to it.
I want to align them in a line.
<div class="col-lg-4">
<h4>Stunning Layouts</h4>
<div class="one"><i class="fa fa-heart service_icon"></i></div>
<div class="one"><a class="service_para">A website that works perfectly good and give a user warm experience on all mobile and tablet browsers.A website that works perfectly good and give a user warm experience on all mobile and tablet browsers. </a></div>
</div>
and my css is like
.service{
background-color:#fff;
padding:30px 100px;
}
.service_icon{
color:#fff;
background-color:#CE1E47;
padding:20px;
margin-right:10px;
border-radius:50%;
}
.one{
display:inline;
height:100%;
}
but if i write more text it gets written under the icon. i want both of them separated side by side even if i write 100 lines of text.
i hope you get it???

display: table-cell is what you need.
Check this fiddle
update your css -
.one{
display:table-cell;
}

There are several methods, here's one using positioning and padding:
http://codepen.io/anon/pen/RWGQyG
<div class="col-lg-4">
<h4>Stunning Layouts</h4>
<div class="icon-text">
<i class="fa fa-heart service_icon"></i>
<p>A website that works perfectly good and give a user warm experience on all mobile and tablet browsers.A website that works perfectly good and give a user warm experience on all mobile and tablet browsers. A website that works perfectly good and give a user warm experience on all mobile and tablet browsers.A website that works perfectly good and give a user warm experience on all mobile and tablet browsers</p>
</div>
</div>
.icon-text{
position: relative;
padding-left: 50px;
}
.service_icon{
position: absolute;
left: 0;
color:#fff;
background-color:#CE1E47;
padding:20px;
margin-right:10px;
border-radius:50%;
}

Add this css.
.service_icon{
color:#fff;
background-color:#CE1E47;
padding:20px;
margin-right:10px;
border-radius:50%;
display: inline-block;
}
.one{
display:inline;
height:100%;
float: left;
}
.one:first-child{
width: 20%;
}
.one:last-child{width: 80%;}
you can test here http://jsfiddle.net/prakashlaxkar/z6m9zk8m/

Related

Need Help in Div Management Please

I am a Beginner Website Developer, I want to make my college's project but stuck at the beginning because my navigation div and small divs in navigation div are not going to transform or transit at once. when i apply transition at one of em with absolute position all (also apply absolute position to other three small divs) the all three of em except first disappears. Code is linked. I want to make navigation just like IMDB's Navigation. (with downside transition and with links and picture at one end.)
-Thank in advance.
HTML CODE:
<body>
<div id="Papadiv">
<header id="Header">
<Div id="Logodiv">
<img src="Images/Logo.jpg" height="100px" width="100px" />
</Div>
<Div id="Titlediv">
<font size="+5" face="Comic Sans MS, cursive">MobilePassion.com</font>
</Div>
</header>
<nav id="Nav1">
<div id="navoption1">
<a href="Index.html">
New Arrivals</a>
</div>
<div id="navoption2">
<a href="Famousmodels.html">
Famous Models</a>
</div>
<div id="navoption3">
<a href="Whoweare.html">
Who We Are?</a>
</div>
<div id="navoption4">
<a href="Contactus.html">
Contact Us</a>
</div>
</nav>
/* CSS Document */
#Nav1
{
background-color: #FDAA2F;
height:50px;
width:800px;
}
#navoption1
{
background-color:#FD771E;
height:10px;
width:160px;
border-radius:20px;
float: left;
color:#722703;
padding:20px;
text-align:center;
}
#navoption2
{
background-color:#FD771E;
height:10px;
width:160px;
border-radius:20px;
float: left;
color:#722703;
padding:20px;
text-align:center;
}
#navoption3
{
background-color:#FD771E;
height:10px;
width:160px;
border-radius:20px;
float: left;
color:#722703;
padding:20px;
text-align:center;
}
#navoption4
{
background-color:#FD771E;
height:10px;
width:160px;
border-radius:20px;
float: left;
color:#722703;
padding:20px;
text-align:center;
#navoption1:hover
{
color:#C13D04;
background-color: #F5530E;
animation:alternate;
text-decoration:blink;
background-image:url(Rose%20(1).jpg)
}
#navoption2:hover
{
color:#C13D04;
background-color: #F5530E;
animation:alternate;
text-decoration:blink
}
#navoption3:hover
{
color:#C13D04;
background-color: #F5530E;
animation:alternate;
text-decoration:blink
}
#navoption4:hover
{
color:#C13D04;
background-color: #F5530E;
animation:alternate;
text-decoration:blink
}
I think first off you need to do some research on how to build a "CSS Mega Drop Down Menu". (That's usually what they are called and you should be able to find a good example in which you can structure your styling off of.)
A "classic" drop down menu usually contains lists nested (or in your case - divs) within parent list items.
"Here" is a good step by step example that I think should get you off and running.
I have been rtying to find a good resource for an example. These are good examples to learn from i think. http://code-tricks.com/simple-css-drop-down-menu/ , http://css-tricks.com/simple-jquery-dropdowns/ . It would also be wise for user experience to use hoverintent (http://cherne.net/brian/resources/jquery.hoverIntent.html) or a delay. This creates a better user experience.

how do i sort out this css

I have a code everything seem alright but the front end being rendered isn't. I have four boxes with a total width of 1000px and each box is 250px floated left, but the page when displayed shows the div as wider than 1000px, i don't know where the ish is, please find below the html code and css for that region:
<div class="strategy">
<div class="strat">
<p>To ensure our clients get the best results, we employ a strategy which takes time to create the best possible combination of ideas beyond just a random collection of texts and images.</p>
</div>
</div>
<div class="strategy">
<div class="design">
<h2>Design</h2>
<p>We plan and strategize your project through even before starting it. An evaluation meeting is scheduled with you to get a chance to understand what your requirements are. We analyze, review and discuss with you on various options for your project. This will guide our brainstorming, research and gathering of content for designing the best solution for you.
</p>
</div>
</div>
<div class="strategy">
<div class="develop">
<h2>Develop</h2>
<p>Based on the deliverables from the design step, we set to work harnessing our talents and appropriate technologies available to execute the project with focus on quality, cost and time. The client is carried along and kept in the loop at each stage for design approvals through our Online Project Sneak-Peek Platform (PSP Platform). This allows you to keep track of changes and updates into ensuring that the project, no matter how small or large, is a complete success.
</p>
</div>
</div>
<div class="strategy">
<div class="deploy">
<h2>Deploy</h2>
<p>Finally your project is ready for deployment. This is in two phases; first phase in which we deploy project for debugging and troubleshooting for errors and glitches. When this phase has been certified then we move to the second phase which is the final deployment of the project and handover.
</p>
</div>
</div>
<div class="clear"></div>
and the css for it is:
#about{
width:100%;
}
#about .about{
width:1000px;
margin:auto;
text-align:justify;
border-bottom:solid #000 1px;
padding:0 0 20px 0;
}
.about h1 {
width:1000px;
margin:auto;
text-align:left;
padding:50px 0;
font-size:40px;
font-weight:normal;
border-bottom:solid #000 1px;
}
.about h2 {
width:1000px;
margin:auto;
text-align:left;
padding:20px 0;
font-size:25px;
font-weight:normal;
}
.about p{
font-size:14px;
}
.about .strategy{
width:25%;
float:left;
text-align:left;
color:#fff;
}
.about .strat{
background:#33bbec;
padding:90px 20px 0 20px;
height:370px;
}
.about .design{
background:#5a5a5a;
padding:15px 20px;
height:430px;
}
.about .develop{
background:#4a4a4a;
padding:15px 20px;
height:430px;
}
.about .deploy{
background:#3e3e3e;
padding:15px 20px;
height:430px;
}
Why are you nesting your divs? And in your CSS you are styling the headers to be 1000px? Thats not right dude..your code is a mess...style the DIV CLASS ...not the headers...

Why are my div images not filling up the entire div box?

I can't for the life of me figure out why in Google Chrome the images in the .productimage divs aren't completely filling up width wise for the .productbox divs near the bottom of this page here:
http://www.daylightfoods.com/products-beta/
It works perfectly in Mozilla Firefox though.
What I want it to do is for those photos in the Products section boxes to fill up the entire width, just like the boxes up in the Specialty section at the top of the page do. Any suggestions or thoughts? This is a custom coded page within Wordpress.
Is there an issue with the spacing somewhere? Or the CSS? I'm including snippets of the code here:
<img src="../wp-content/themes/mightymitty_custom/assets/whiteleaf_greybg.png" alt="White Daylight Foods Logo"><span style="margin-left:10px;font-family:AvenirRoman,Arial;font-size:36px;color:#fff;">Products</span>
<div class="productbox"><div class="productimage"><img src="http://www.daylightfoods.com/wp-content/themes/mightymitty_custom/assets/products/products_corn.png" alt=""></div><div class="productcaption"><strong>Fresh Produce</strong><br>Located in the heart of the Silicon Valley, we are in close proximity and have access to the highest quality produce year around from trusted growers on the Central Coast, San Joaquin Valley and specialty growers along the North Coast.</div>
<div class="productbox"><div class="productimage"><img src="../wp-content/themes/mightymitty_custom/assets/products/products_organic.png" alt=""></div><div class="productcaption"><strong>Organic</strong><br>As certified organic produce distributors, we source the highest quality Certified Organic produce from trusted growers.</div>
And here is a copy of the relevant CSS:
.productbox {
display:inline-block;
height:360px;
width:310px;
margin:10px;
background-color:#fff;
-moz-border-radius-bottomright: 30px;
border-bottom-right-radius: 30px;
-moz-border-radius-bottomleft: 30px;
border-bottom-left-radius: 30px;
vertical-align:top; }
.producttitle {
font-family:arial;
font-size:14px;
font-weight:bold; }
.productimage {
width:318px;
height:210px;
padding:0px; }
.productcaption {
height:140px;
font-family:arial;
font-size:12px;
padding-left:15px;
padding-top:12px;
padding-right:15px;
padding-bottom:10px; }
.producttags {
font-family:arial;
font-size:11px;
color:#9aca3c;
padding-left:15px;
padding-bottom:10px; }
What am I doing wrong?
You aren't defining any image dimensions in your code. Therefore the image will default to it's actual size.
Try something like this in your CSS
.productbox .productimage img {
width: 100%;
height: 100%;
height: auto;
}
Another issue you're having is you have productbox with a width of 310px and productimage has a width of 318px. Here is a working fiddle for you. JSFiddle

Website layout gets messy under different screens resolutions

I'm designing a website. My monitor's resolution is 1280 x 1024 and I usually use Firefox for developing. This is how it looks and should look. This one is the correct one.
But there's a slight change when viewed in Chrome in the same monitor. Notice the right bottom corner.
Things get even worse when viewed in a another monitor with a different screen resolution. This is my screen at work which's resolution is 1366 x 768.
On Firefox
On Chrome
As you can see, the layout is messed up pretty bad. Below is the code.
HTML
<img id="yellowRing" src="images/about_rings/yellow_ring.png" />
<img id="magentaRing" src="images/about_rings/magenta_ring.png" />
<img id="blueRing" src="images/about_rings/blue_ring.png" />
<div id="aboutCaption">
<p>Our Team</p>
</div>
<div id="team">
<div class="member"><a data-member="one" href="#"><img src="images/team/one_thumbnail.png" /></a></div>
<div class="member"><a data-member="two" href="#"><img src="images/team/two_thumbnail.png" /></a></div>
<div class="member"><a data-member="three" href="#"><img src="images/team/three_thumbnail.png" /></a></div>
<div class="member"><a data-member="four" href="#"><img src="images/team/four_thumbnail.png" /></a></div>
</div>
CSS
#yellowRing {
position:absolute;
left:1200px;
bottom:-1300px;
z-index:2;
}
#magentaRing {
position:absolute;
left:1600px;
bottom:-1100px;
z-index:3;
}
#blueRing {
position:absolute;
left:2160px;
top:500px;
z-index:4;
}
#aboutCaption {
position:absolute;
left:2430px;
top:-50px;
z-index:4;
line-height:2.2em;
}
#aboutCaption p {
font-weight:lighter;
text-align:right;
color:#FFF;
font-size:55px;
}
#team {
position:absolute;
left:2135px;
top:90px;
width:432px;
height:110px;
z-index:4;
}
.member {
position:relative;
height:95px;
width:95px;
margin:8px 8px 8px 0px;
z-index:5;
display:inline-block;
}
.member:nth-child(1) {
margin-left:8px;
}
.member img {
height:95px;
width:95px;
}
This website only scrolls horizontally. My question is, why this is happening? And what should I do to make the layout consistent despite the screen size or the resolution? Or do I have to go about the responsive design and include multiple CSS files per benchmark?
Thank you.
To cover all platforms/browsers/etc... you will have to euther use a framework, which gets bulky, or if you're keeping it simple, I would go with some #media rules in order to cover your different layout dimensions. Basics of it can be found at W3 Media Types

Rotated DIV edges blurry in Chrome

I have an audio post where the information is in rotated DIVs that are displayed on top of the album art. To see what I mean go here (the page). The area on the bottom left corner is the information. When viewed in Chrome you will see that the edges of the DIVs are blurred. Is there a way to "alias" the DIVs so they appear sharp? I know it's not a resolution thing because Firefox displays them perfectly.
.audioBox {
position:absolute;
bottom:160px;
margin-left:-11px;
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
z-index:3;
width:343px;
}
.boxify {
margin:1px;
padding:5px;
float:left;
bottom:0;
width:329px;
}
.box {
background:#000;
padding:5px;
padding-left:10px;
padding-right:10px;
margin-left:-5px;
}
<div class="audioHolder">
<div class="audioBox">
<div class="boxify" id="song">
<img id="audioBubble"
src="http://static.tumblr.com/ux4v5bf/JC6lpv4v1/audio.png">
{block:TrackName}
<span class="box">{TrackName}</span>
{/block:TrackName}
</div>
<div class="boxify" id="artist">
{block:Artist}
<span class="box">{Artist}</span>
{/block:Artist}
</div>
<div class="boxify" id="label">
<span class="box">{PlayCountWithLabel}</span>
</div>
<div class="boxify" id="download">
<span class="box">Download
{block:ExternalAudio}
Download
{/block:ExternalAudio}</span>
</div>
</div>
Solution: I replaced the background color with a background image of the same color instead. :-) Hope it helps somebody else with a similar problem.
I know I'm little late but...
I have similar problem now and in my case changing the size helps, just use even numbers
.blurry {
left: 100px;
height: 30px;
width: 135px;
}
.sharp {
left: 200px;
height: 30px;
width: 136px;
}
http://jsfiddle.net/_hags/9e4cS/