/    Sign up×
Community /Pin to ProfileBookmark

I’m new – understanding CSS’s block element & MSIE6/7

Hello

To start, I’m learning CSS, so this is mostly a post asking for help understanding things (and also for input on how to code better).

I have a page I’m comping out for a Client:

[url]http://www.dorseygraphics.com/review/vialuxe/web2010/01/index.html[/url]

It uses an external CSS doc:

[url]http://www.dorseygraphics.com/review/vialuxe/web2010/01/css/styles.css[/url]

I borrowed a lot of the main formatting from Dreamweaver CS5’s templates, as they seem to work well cross-browser & platform.

ISSUE:

My images are exhibiting space above and below in MSIE (view the section bottom just below the word “content” in the design in MSIE6/7 – I left this one unfixed to demonstrate the issue). I did some web searching and found that if I force them to act as block elements, then that gets rid of the MSIE padding.

I created the following code in my CSS doc to address the issue:

[CODE].block {display: block;}[/CODE]

Then I used span tags around the offending images and the unwanted space disappeared! Voila!

BUT…

I’m sure this is not the cleanest way to accomplish this. What would be a better way? What is the accepted way to do this so I don’t have to place span tags around all my images?

Thanks,

———-S

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@Sub_SevenJun 19.2010 — Are you talking about the space between the content block and the footer?
Copy linkTweet thisAlerts:
@spdorseyauthorJun 19.2010 — Correct. The space surrounding the lower image that appears below the word "Content" in yellow. I left the <span> tag off of the image in this instance to show the issue I was experiencing. I fixed it in other places.

But the real issue is not how to fix the space. What I would really like to know is how it could be fixed in a better way. I may be wrong about this, but it seems to me that placing a <span> around each image that I need to be a block element is not the cleanest way to do it.

I'm new to CSS, so it's probably a stupid question that has an easy answer...

Thanks,

------------S
Copy linkTweet thisAlerts:
@Sub_SevenJun 19.2010 — I would delete the <span> and make it a <div> and in the css specify things like width, height, and background image (or whatever is necessary to make it look the way you want).

I'm no expert but when it comes to formatting with css I get away easily, my real advise is get rid of templates and write everything yourself, it might be hard at the beginning but once you get the hang of it you have full control over your code...
×

Success!

Help @spdorsey spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...