Due to imperfect manufacturing crafts and external factors, steel often produces surface defects during manufacturing, seriously influencing its lifespan and availability. It is therefore crucial that surface defects are detected in industrial production. Nevertheless, conventional detection techniques are vulnerable to background interference and feature scale variations when employed to identify defects on strip surfaces. Therefore, we propose an EGC-YOLO model based on YOLOv8 for steel surface defect detection. First, an edge detail enhancement module (EDEM), based on Sobel convolution (SobelConv), is designed and embedded into C2f to capture defective edges and texture better. Second, the generalized dynamic feature pyramid network (GDFPN) is introduced in the neck structure to enhance the multiscale feature fusion. This enables the model to adapt to defects of different sizes and shapes. Finally, the content-guided attention fusion (CGA Fusion) module is employed to optimize the fusion of shallow and deep features for more detection precision. The extensive experimental results illustrate that the accuracy of EGC-YOLO reaches 80.2% mAP on NEU-DET and improves by 3.7% over YOLOv8. The model's inference speed reached 136.4 frames per second (FPS). EGC-YOLO outperforms other models in accuracy and speed for detecting steel surface defects, showcasing its industrial application potential.