Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-08-2012, 05:26 AM   PM User | #1
SRD75
Regular Coder

 
Join Date: Sep 2011
Posts: 148
Thanks: 28
Thanked 1 Time in 1 Post
SRD75 is an unknown quantity at this point
inline Div behaving like a block

Hi. I'm editing a Wordpress on localhost. Unfortunately I cannot show you a live example. I'm hoping some screenshots and a description can help you diagnose the issue.

I've taken a Wordpress theme, and inserted a "contactus" div in the header:

Code:
<body>
<div id="main-container">
  <div class="center">
    <div id="site">
      <div id="header" >
        <div id="contactus">
	  1300 332 673
        </div>
        <div id="header-top">
          <div id="logo-container" class="center"><a href="<?php echo home_url(); ?>"></a></div>
          <div id="menu-container">
This is the page before inserting the contactus div.
This is the page after inserting the contactus div.

This is the CSS for contactus:
Code:
#contactus{
	height: 25px;
	float: right;
	padding: 1em 0.5em 0 0;
	display: inline;
}
As you can see, it is inline.

However, the div is pushing down the navigation menu, as if it is acting like a block.

I thought an inline element would occupy empty space, without pushing other things around?

Last edited by SRD75; 10-08-2012 at 05:29 AM..
SRD75 is offline   Reply With Quote
Old 10-08-2012, 09:23 AM   PM User | #2
Candygirl
Regular Coder

 
Candygirl's Avatar
 
Join Date: Apr 2008
Location: Switzerland
Posts: 179
Thanks: 3
Thanked 54 Times in 54 Posts
Candygirl is on a distinguished road
Well, it actually is a block element
As describe in the css recommandation, using a float generates automaticaly a block box:
Quote:
left
The element generates a block box that is floated to the left. Content flows on the right side of the box, starting at the top (subject to the 'clear' property).
Adding a display:inline to a floating element has no effect except preventing the double margin bug in IE6.
__________________
"Imagination was given to man to compensate for what he is not;
a sense of humour to console him for what he is."
-Francis Bacon
Candygirl is offline   Reply With Quote
Old 10-09-2012, 02:32 AM   PM User | #3
SRD75
Regular Coder

 
Join Date: Sep 2011
Posts: 148
Thanks: 28
Thanked 1 Time in 1 Post
SRD75 is an unknown quantity at this point
Thank you CandyGirl.

I ended up using a background image to display the phone number.
SRD75 is offline   Reply With Quote
Reply

Bookmarks

Tags
block, inline

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:06 PM.


Advertisement
Log in to turn off these ads.